MAC Get the system version and model

2023-01-23   ES  

By leaving Game Framework to load a simple UI, everyone should know, so how to use it under the game framework framework?

Game Framework loads UI. To put it plainly, it is to use the UI Component to uniformly load and manage the UI prefab to avoid a large number of UI scattered in the scene and management difficulties.

Let’s build a UI default body first.

Open our previous project and create a new UI first. I renamed the UI as HelloWorld. It just prints on the screenHello,World!, nothing else.

Then add the UI logic of this UI. Game Framework will report an error if you can’t detect the logical script of the UI.

Create a script, the name I created isUI_HelloWorld

using UnityGameFramework.Runtime;
public class UI_HelloWorld : UIFormLogic


Because we just call it alone, we don’t need any substantial functions, so we don’t need to write anything in the class.

Then mount this script to the UI we just created, and then save the UI into Prefab.

What we have to do next is where we do

This UI is loaded in theProcedureMainprocess.

We must first create a UI group to store this UI.

Click in the Example sceneGameFramework, found itUIObject.

willUI ComponentUI GroupsSizeChange to 1, and then give it to the new appearanceElement 0NAME just starts with one, here I start hereDefaultGroup

This way we can adjust the UI to this group in a while.

OpenProcedureMainscript, add a few lines of code to the ** Onener () ** to let it load the UI when entering:

Don’t forget to addUnityGameFramework.RuntimeProbes

using GameFramework;
using GameFramework.Procedure;
using UnityGameFramework.Runtime;  // Don't forget this
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;

namespace Game
    public class ProcedureMain : ProcedureBase
        // execute when the game initializes.
        protected override void OnInit(ProcedureOwner procedureOwner)

        // Enter this process every time you enter this process.
        protected override void OnEnter(ProcedureOwner procedureOwner)
            Log.Debug("Enter ProcedureMain!");
            // Load the framework UI component
            UIComponent UI = GameEntry.GetComponent<UIComponent>();
            // Load UI

        // Each round of inquiry execution.
        protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);

        // execute each time the process is left.
        protected override void OnLeave(ProcedureOwner procedureOwner, bool isShutdown)
            base.OnLeave(procedureOwner, isShutdown);

        // execute when the game exits.
        protected override void OnDestroy(ProcedureOwner procedureOwner)

After saving, we can see the effect. Back to Unity, click the Play button.

UI was loaded by us.

Open UI Component step by step, we can see that UI is indeed loaded here.

This is here

This section is here, goodbye to the next article.


Related Posts

Funds flow outflow prediction-time sequence

C ++

Samba service configuration

Define a custom event named Double_Bullet_time_finish to limit the use of super bullets #使用 Is it using a super bullet is_double_bullet = false … … in the main loop while … #Incident detection cycle: Em #The trigger super bullet end event event.type == double_bullet_time_finish: is_double_bullet = false #Super bullet effect cancellation pygame.time.set_timer (double_bullet_time_finish, 0)# Em #Draw the super bullet supply and detect whether it is obtained if bullet_supply.move () screen.blit (bullet_supply.image, bullet_supply.rect) if pygame.sprite.collide_mask (bullet_supply, me): #Directly detect bomb_supply, whether the two elves have collided () # Is_double_bullet = TRUE #Start firing super bullets pygame.time.set_timer (double_bullet_time_finish, 18 * 1000) #custom event Double_bullet_time_finish will be generated after 18 seconds (after 18 seconds, the super bullet fails) = false

MAC Get the system version and model

Random Posts

SWUSTOJ (594) Maximum Tape Utilization Ratio (the easiest to understand)

WeChat retrieved code scanning

Android compilation system analysis, detailed explanation of the call order of the MK file after executing Make Bootimage

Android realizes sliding suspension top effect Shirly

ACM Common algorithm template