Ejemplo n.º 1
0
        // todo: look up way of making strings without garbage

        public FrameRateUI(UIStyle style, GraphicsDevice g, string font = "NotoMono-Regular", int?fontsize = 14)
        {
            GraphicsDevice = g;
            UISystem       = new UISystem(g);

            FRListener = new FramerateListener();
            UISystem.Add(FRListener);

            FRLabel = new UILabel(g.PresentationParameters.BackBufferWidth, 0, 100, 12, "TTT", font: font, fontsize: fontsize);
            UISystem.Add(FRLabel);

            DRLabel = new UILabel(g.PresentationParameters.BackBufferWidth, 12, 100, 12, "TTT", font: font, fontsize: fontsize);
            FRListener.AttachedLabel = DRLabel;
            UISystem.Add(DRLabel);
            DRLabel.EventPostInit += (s, e) =>
            {
                DRLabel.y = FRLabel.y + FRLabel.Height;
            };

            //TLabel = new UILabel(g.PresentationParameters.BackBufferWidth, 24, 100, 12, "TTT", fontsize: 10);
            //UISystem.Add(TLabel);


            UISystem.Init(style);
        }
Ejemplo n.º 2
0
    private void InitSystem()
    {
        environmentSystem.Init(this);
        roleSystem.Init(this);
        aISystem.Init(this);
        eventSystem.Init(this);
        functionSystem.Init(this);
        uISystem.Init(this);

        inputSystem.Init();
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        centerCtrl = GetComponent <CenterCtrl>();
        centerCtrl.Init(this);

        uiSystem = GetComponent <UISystem>();
        uiSystem.Init(this);

        vibrateSys = new VibrateSystem();
        vibrateSys.Init();
    }
Ejemplo n.º 4
0
        public TestUI(UIStyle style, GraphicsDevice graphicsDevice)
        {
            UISystem = new UISystem(graphicsDevice);
            // panel 1
            UIPanel panel = new UIPanel(25, 25, 150, 150, hastitle: true, title: "Test Panel 1", titlesize: 16);

            UISystem.Add(panel);

            UILabel label1 = new UILabel(0, 0, panel.Width - 10, 10, "text goes here let's see if it will wrap automatically, which it should if everything is working properly.", fontsize: 12,
                                         font: "NotoSans_regular"); // test spritefont

            panel.AddAuto(label1);

            // panel 2
            UIPanel panel2 = new UIPanel(225, 25, 150, 150, hastitle: true, title: "Test Panel 2", titlesize: 16);

            UISystem.Add(panel2);

            UIButton button1 = new UIButton(5, 5, 75, 25, "Test Button");

            panel2.AddAuto(button1);

            UICheckbox chk1 = new UICheckbox(5, 40, 20, 20);

            panel2.Add(chk1);
            UILabel chk1label = new UILabel(30, 40, 100, 20, "unchecked");

            panel2.Add(chk1label);
            chk1.EventCheckChanged += (sender, args) =>
            {
                if (chk1.Checked)
                {
                    chk1label.Text = "checked";
                }
                else
                {
                    chk1label.Text = "unchecked";
                }
                chk1label.ProcessText();
            };


            // panel 3
            UIPanel panel3 = new UIPanel(425, 25, 150, 150, hastitle: true, title: "Test Panel 3", titlesize: 12);

            UISystem.Add(panel3);

            UITextField textfield1 = new UITextField(5, 5, 135, 25, "", fontsize: 16, placeholdertext: "Try Typing...");

            panel3.AddAuto(textfield1);

            UINumberField numfield1 = new UINumberField(5, 5, 135, 35, 40, "0", true, fontsize: 16);

            panel3.AddAuto(numfield1);

            UINumberField numfield2 = new UINumberField(5, 5, 135, 35, 40, "0.0", false, fontsize: 16);

            panel3.AddAuto(numfield2);

            // panel 4
            UIPanel panel4 = new UIPanel(625, 25, 150, 150, hastitle: true, title: "Test Panel 4", titlesize: 14);

            UISystem.Add(panel4);

            UILabel label2 = new UILabel(0, 0, panel4.Width - 10, 10, "text goes here let's see if it will wrap automatically, which it should if everything is working properly.", fontsize: 18);

            label2.TextSplitWords = true;
            panel4.AddAuto(label2);
            UILabel label3 = new UILabel(0, 10, panel4.Width - 10, 10, "A second auto-label. This gal should automatically get cut off when it goes too long", fontsize: 16);

            label3.TextSplitWords = true;
            panel4.AddAuto(label3);

            // panel 5
            UIPanel panel5 = new UIPanel(25, 200, 150, 150, true, "Dropdown Test");

            UISystem.Add(panel5);

            UIDropdown drop1 = new UIDropdown(0, 0, 80, 30, "droptest");

            drop1.AddItem("log A", (uid, args) => { drop1.Text = "AAAA"; drop1.ProcessText(); });
            drop1.AddItem("log B", (uid, args) => { drop1.Text = "BBBB"; drop1.ProcessText(); });
            panel5.AddAuto(drop1);

            // panel 6
            UIPanel panel6 = new UIPanel(200, 200, 150, 150, true, "Scroll Vert Test", hasscrolling: true, scrollh: 400);

            UISystem.Add(panel6);
            UILabel label4 = new UILabel(0, 10, panel6.Width - 20, 350, "newlines \n should be auto processed 1\n 2\n 3\n 4\n 5\n test the bottom \n test", fontsize: 16);

            panel6.AddAuto(label4);

            // panel 7
            UIPanel panel7 = new UIPanel(400, 200, 150, 150, true, "Scroll Horz Test", hasscrolling: true, scrollw: 400);

            UISystem.Add(panel7);
            UILabel label5 = new UILabel(0, 10, panel7.ScrollWidth - 10, 10, "a very long bit a text. It just goes on and on and doesn't end. A very long line that should be much smaller. But it's not, it's very large, instead.", fontsize: 18);

            panel7.AddAuto(label5);

            // panel 8
            UIPanel panel8 = new UIPanel(600, 200, 150, 150, true, "Dialogs Test");

            UISystem.Add(panel8);
            UIButton popupbtn = new UIButton(0, 0, 100, 30, "pop up");

            panel8.AddAuto(popupbtn);
            UIButton filebtn = new UIButton(0, 0, 100, 30, "open file");

            panel8.AddAuto(filebtn);

            popupbtn.EventFocused += (sender, args) =>
            {
                UIComponent.EventFocusedHandlerArgs eargs = args as UIComponent.EventFocusedHandlerArgs;
                DialogPopup popup = new DialogPopup("Popup", "time elapsed: " + eargs.ElapsedMS);
                popup.Popup(UISystem);
                popup.EventClosed += (innersender, innerargs) =>
                {
                    popup.Dispose();
                };
            };
            filebtn.EventFocused += (sender, args) =>
            {
                UIComponent.EventFocusedHandlerArgs eargs = args as UIComponent.EventFocusedHandlerArgs;
                DialogFile filepopup = new DialogFile(DialogFile.eMode.SELECT_FILE, ".\\", "file.txt", "Select a File");
                filepopup.Popup(UISystem);
                filepopup.EventClosed += (innersender, innerargs) =>
                {
                    filepopup.Dispose();
                };
            };

            // panel 9
            UIPanel panel9 = new UIPanel(100, 350, 220, 100);

            UISystem.Add(panel9);
            UITextField multiLineText = new UITextField(0, 0, 200, 80, "", autoheight: false, placeholdertext: "try typing multi lines", fontsize: 11)
            {
                MultiLine = true
            };

            multiLineText.SetTextStyler(new TextStylerTest());
            panel9.Add(multiLineText);

            // panel 10
            UIPanel panel10 = new UIPanel(20, 20, 400, 400, true, "RelaScript", titlesize: 12, hasclose: true);

            panel10.CloseButton.EventFocused += (sender, eargs) =>
            {
                panel10.Visible = false;
            };
            UISystem.Add(panel10);
            UITextField relaMultiText = new UITextField(5, 5, 380, 350, "", autoheight: false,
                                                        fontsize: 18, font: "NotoMono-Regular")
            {
                MultiLine = true
            };

            relaMultiText.EventPostInit += (sender, eargs) =>
            {
                relaMultiText.TextColor = new Microsoft.Xna.Framework.Color(218, 218, 218, 255);
            };
            relaMultiText.SetTextStyler(new TextStylerRelaScript());
            panel10.Add(relaMultiText);

            UISystem.Init(style);
        }
Ejemplo n.º 5
0
    /// <summary>
    /// 创建通用逻辑模块,主场景和战斗场景均使用,依赖配置表,通常情况下需要更新资源后再执行
    /// </summary>
    public IEnumerator CreateEnumerator()
    {
        bCreated = false;

        Type[] types = new Type[]
        {
            typeof(AssetSystem),
            typeof(ShaderLib),
            typeof(SceneManager),
            typeof(NatureManager),
            typeof(WarFogManager),
        };

        CreateModulesAsyn(types);

        //wait another coroutine finish
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            bool bOK = (CreatingModules.Count == 0);
            if (bOK)
            {
                break;
            }
        }

        yield return(new WaitForSeconds(0.1f));

        if (!Application.isEditor && System.IO.File.Exists("BreakPoint.txt"))
        {
            GameUtil.MsgBox(m_WindowHwnd, "挂断点", "调试", 0);
        }

        if (!RenderViewAPI.Start())
        {
            Trace.LogError("Game Start Service failure");
            yield break;
        }
        Trace.Log("Game Start Service successed");
        // 初始化
        gameObject.AddComponent <GameViewCommandHandler>();

        OnDeviceStateChage += OnDeviceStateChange;

        // 初始化游戏接口
        IntPtrHelper helper = new IntPtrHelper();

        //GameLogicAPI.Start(ASpeedGame.Data.GameSettingsXml.GameSettingsXmlManager.Instance.GameSettingsModel.enableMultiThread.AValue,
        //    helper.toPtr(ref RenderViewAPI.g_RenderView));
        GameLogicAPI.Start(helper.toPtr(ref RenderViewAPI.g_RenderView));
        yield return(new WaitForSeconds(1.0f));

        PrintTickCheck("初始化逻辑层API,至少等了1秒", CostThreshold_Lv1, _bStart: true);

        // 显示层配置价值
        ViewConfigManager.Init();
        PrintTickCheck("ViewConfigManager.Init");


        //资源是要配置初始化
        AssetBundleManager.Init();
        PrintTickCheck("AssetBundleManager.Init");



        LogicDataCenter.Init();
        PrintTickCheck("LogicDataCenter.Init");



        ImageSetting.Init();
        PrintTickCheck("ImageSetting.Init");

        ImageEffectManager.API_GameStart();
        PrintTickCheck("ImageEffectManager.Init");

        //GameViewCommandHandler.Instance.Start();
        MouseCursorManager.Instance.InitMouseCursorManager();
        PrintTickCheck("MouseCursorManager.Init");

        // 初始化实体接口,依赖上面的物件管理器所以顺序不能换
        EntityFactory.Init();
        PrintTickCheck("EntityFactory.Init");


        PrefabManager.Init();
        PrintTickCheck("PrefabManager.Init");


        SkinManager.Init();
        PrintTickCheck("SkinManager.Init");



        SoundManager.Init();
        PrintTickCheck("SoundManager.Init");

        UISystem.Init();
        PrintTickCheck("UISystem.Init");

        UTopNameManager.Init();
        PrintTickCheck("UTopNameManager.Init");

        USpeedUI.Blood.UBloodManager.Init();
        PrintTickCheck("UBloodManager.Init");



        InputManager.Init();
        PrintTickCheck("InputManager.Init");



        Effect.EffectNode.InitTargetCache();
        PrintTickCheck("Effect.EffectNode.InitTargetCache.Init");

        GUIDE.GuideManager.Init();
        PrintTickCheck(" GUIDE.GuideManager.Init");

        SceneEffectManager.Init();
        PrintTickCheck("SceneEffectManager.Init");
        if (LightingEffectFactory.Instance)
        {
            LightingEffectFactory.Instance.InitWhenGameStart();
        }
        PrintTickCheck("LightingEffectFactory.Init");

        SafeZoneEffectManager.Init();
        PrintTickCheck("SafeZoneEffectManager.Init");

        ImageSetting.TraceSettings();

        bCreated = true;

        List <string> argList = new List <string>();

        argList.AddRange(System.Environment.GetCommandLineArgs());

        CkeckUpdateOk(ref argList);
        PrintTickCheck("CkeckUpdateOk");

        CheckMultclient();
        PrintTickCheck("CheckMultclient");

        StageManager.Init();
        AssetBundleManager.DeleteAssets(ref LoadingWaitngResNode, true);
    }
Ejemplo n.º 6
0
        public ConsoleUI(UIBoss boss, UIStyle style, GraphicsDevice g, IConsole console,
                         int width, int height,
                         int logstoload = 30, string font = "NotoMono-Regular", int?fontsize = 16)
        {
            Boss = boss;

            Console  = console;
            UISystem = new UISystem(g);

            LogsToLoad = logstoload;
            int hperlog = 16;

            int innerHeight = (hperlog + 4) * LogsToLoad;

            LogList = new UIAutoList(eUIOrientation.VERTICAL, width - 16 - 4, innerHeight,
                                     fixedindexwidth: width - 16 - 4, fixedindexheight: hperlog, alternatesBackground: true);
            LogList.HasBorder      = false;
            LogList.HasOuterBorder = false;
            LogList.MarginY        = 2;


            for (int i = 0; i < LogsToLoad; i++)
            {
                UILabel lab = new UILabel(0, 0, width - 16, hperlog, "",
                                          font: font, fontsize: fontsize)
                {
                    TextOneLineOnly = true
                };
                Labels.Add(lab);
                LogList.AddAuto(lab);
            }



            LogPanel = new UIPanel(0, 0, width, height,
                                   true, "Console",
                                   hasscrolling: true, scrollh: innerHeight);
            LogPanel.AutoScrollHeight = true;
            LogPanel.AddAuto(LogList);

            LogPanel.Visible = false;

            ScrapLabel         = new UILabel(0, 0, width - 32, hperlog, "");
            ScrapLabel.Visible = false;
            LogPanel.Add(ScrapLabel);

            InputField = new UITextField(0, 0, width - 24, hperlog, "",
                                         font: font, fontsize: fontsize, placeholdertext: "Input...");
            InputField.EventEnterPressed += (sender, e) =>
            {
                string inputtext = InputField.Text;
                UITextField.EventEnterPressedHandlerArgs eargs = (e as UITextField.EventEnterPressedHandlerArgs);
                InputField.ClearText(eargs.ElapsedMS, eargs.Input);
                InputField.CaretPosition = 0;
                Console.Input(inputtext);
            };
            LogPanel.AddAuto(InputField);

            UISystem.Add(LogPanel);

            UISystem.Init(style);

            LogPanel.SnapScrollToBottom();

            /*UILabel firstLabel = (LogList.Components[0] as UILabel);
             * firstLabel.EventPostInit += (sender, args) =>
             * {
             *  MaxLength = (LogPanel.Width - 32) / firstLabel.FontSettings.MonospaceSize;
             * };*/
        }