コード例 #1
0
 protected override void OnInit()
 {
     m_twoFirst_btn  = this.Make <GameButton>("btn0");
     m_twoSecond_btn = this.Make <GameButton>("btn1");
     m_twoFirst_lab  = m_twoFirst_btn.Make <GameLabel>("Text");
     m_twoSecond_lab = m_twoSecond_btn.Make <GameLabel>("Text");
 }
コード例 #2
0
    private void _on_FileHTTPRequest_request_completed(int result, int response_code, string[] headers, byte[] body)
    {
        if (result == (int)HTTPRequest.Result.Success && response_code == 200)
        {
            string final_filename = http_node.DownloadFile.Substring(0, http_node.DownloadFile.Length - 5);
            new Directory().Rename(http_node.DownloadFile, final_filename);
            var entry = generateBinWorld(final_filename);

            if (entry != null)
            {
                download_button.markCompleted();
                download_button.incDownloads(); // TODO: increment count only on first download (use RateAdded event)
                download_button.worldEntry.MergeLocal(entry);
                finished_entries.Enqueue(entry);
                sendDownload();
            }
            else
            {
                new Directory().Remove(final_filename);
                download_button.markFailed();
            }
        }
        else
        {
            download_button.markFailed();
            http_node.cleanup();
        }

        GetNode <Timer>("DownloadMonitor").Stop();
        http_node.DownloadFile = null;
        download_button        = null;
    }
コード例 #3
0
 protected override void OnInit()
 {
     base.OnInit();
     this.m_iconImg = Make <GameImage>("Image");
     this.m_mask    = Make <GameImage>("Background");
     this.m_btn     = Make <GameButton>("Image");
 }
コード例 #4
0
        private void InitController()
        {
            //m_icon_tex = Make<GameTexture>("icon");
            m_chooseRoot_obj    = Make <GameUIComponent>("Image");
            m_chooseContent_lab = m_chooseRoot_obj.Make <GameLabel>("content");

            m_textPanel_obj = m_chooseRoot_obj.gameObject.transform.Find("Panel_text").gameObject;
            m_imgPanel_obj  = m_chooseRoot_obj.gameObject.transform.Find("Panel_image").gameObject;

            m_text_toggle = new GameToggleButton[MaxChooseNum];
            m_img_toggle  = new GameToggleButton[MaxChooseNum];
            m_ask_img     = new GameImage[MaxChooseNum];
            m_ask_lab     = new GameLabel[MaxChooseNum];
            for (int i = 0; i < MaxChooseNum; i++)
            {
                m_text_toggle[i]         = m_chooseRoot_obj.Make <GameToggleButton>(string.Format("Panel_text:Toggle_{0}", i));
                m_img_toggle[i]          = m_chooseRoot_obj.Make <GameToggleButton>(string.Format("Panel_image:Toggle_{0}", i));
                m_ask_img[i]             = m_img_toggle[i].Make <GameImage>("Image");
                m_img_toggle[i].Visible  = false;
                m_ask_lab[i]             = m_text_toggle[i].Make <GameLabel>("Label");
                m_text_toggle[i].Visible = false;
            }

            m_textRoot_obj      = Make <GameButton>("Text");
            m_noContent_lab     = m_textRoot_obj.Make <GameLabel>("content");
            this.m_contentFader = m_noContent_lab.GetComponent <TextFader>();
            fontSize            = m_noContent_lab.Label.fontSize;
            //m_next_btn = Make<GameButton>("Button");
        }
コード例 #5
0
        public void Interact(GameButton button)
        {
            var isAb = button == GameButton.A || button == GameButton.B;

            if (button == GameButton.None || !isAb)
            {
                return;
            }

            DialogController dm = GameManager.Dialog;

            var shouldEndDialog = dm.InDialog() && !dm.HasNext();

            if (shouldEndDialog)
            {
                dm.EndDialog();
                return;
            }

            if (!dm.InDialog())
            {
                if (button == GameButton.A)
                {
                    dm.StartDialog(this);
                }
                return;
            }

            dm.PrintNext();
        }
コード例 #6
0
        protected override void OnInit()
        {
            base.OnInit();
#if OFFICER_SYS
            m_officers_grid = Make <GameUIContainer>("Panel_officer:ScrollView:Viewport");
#endif
            m_event_icon = Make <GameImage>("Image_event:Image_title:Image_Icon");
            m_event_name = Make <GameLabel>("Image_event:Image_title:Text");
            m_event_desc = Make <GameLabel>("Image_event:Text");
            m_case_name  = Make <GameLabel>("Image_event:RawImage:Text");
            m_case_tex   = Make <GameTexture>("Image_event:RawImage");
            m_ok_btn     = Make <GameButton>("Button_action");
            m_ok_effect  = Make <GameUIEffect>("UI_tongyong_anniu");
            m_ok_effect.EffectPrefabName = "UI_tongyong_anniu.prefab";
            m_vit_cost_num_txt           = m_ok_btn.Make <GameLabel>("Image:Text");

            m_keywords_grid = Make <GameUIContainer>("Panel_keyword:ScrollView:Viewport");

            m_normal_title_txt       = Make <GameLabel>("Image_event:Image_normal:Text");
            m_normal_title_txt.Text  = LocalizeModule.Instance.GetString("ui.event.CommonDrop");
            m_perfect_title_txt      = Make <GameLabel>("Image_event:Image_perfect:Text");
            m_perfect_title_txt.Text = LocalizeModule.Instance.GetString("ui.event.FullScoreDrop");
            m_normal_cash_txt        = Make <GameLabel>("Image_event:Image_normal:Image:Text (1)");
            m_perfect_cash_txt       = Make <GameLabel>("Image_event:Image_perfect:Image:Text (1)");


#if OFFICER_SYS
            this.InitOfficersKeywords();
#endif
        }
コード例 #7
0
        private void InitController()
        {
            m_bg_tex           = Make <GameTexture>("bgImg");
            this.m_talkTexture = new TalkSceneTexture[4];

            //m_article_img = new GameImage[4];
            //m_bg_img = new GameImage[4];
            //this.m_person_Img = new GameTexture[4];
            //this.m_articleName_Lab = new GameLabel[4];
            for (int i = 0; i < 4; i++)
            {
                this.m_talkTexture[i]         = Make <TalkSceneTexture>(string.Format("Panel_animation:bgImg:ImageBG_{0}", i));
                this.m_talkTexture[i].Visible = false;
                //m_bg_img[i] = Make<GameImage>(string.Format("Panel_animation:bgImg:ImageBG_{0}", i));
                //m_article_img[i] = m_bg_img[i].Make<GameImage>("Image_things");
                //this.m_person_Img[i] = m_bg_img[i].Make<GameTexture>("Panel_role:RawImage");
                //this.m_articleName_Lab[i] = m_bg_img[i].Make<GameLabel>("Text_name");
                //m_bg_img[i].Visible = false;
            }
            this.m_leftIcon     = Make <GameSpine>("Panel_animation:icon_leftSpine");
            this.m_rightIcon    = Make <GameSpine>("Panel_animation:icon_rightSpine");
            this.m_leftPngIcon  = Make <GameTexture>("Panel_animation:icon_leftPng");
            this.m_rightPngIcon = Make <GameTexture>("Panel_animation:icon_rightPng");
            m_leftPartUI        = Make <TalkPartUIComponent>("Panel_animation:Panel_left");
            m_leftPartUI.SetIcon(m_leftIcon, this.m_leftPngIcon);
            m_rightPartUI = Make <TalkPartUIComponent>("Panel_animation:Panel_right");
            m_rightPartUI.SetIcon(m_rightIcon, this.m_rightPngIcon);
            this.m_btnNext = Make <GameButton>("Panel_animation:Button_skip");
        }
コード例 #8
0
ファイル: GMUILogic.cs プロジェクト: kingpowervrg/my_seeker
        protected override void OnInit()
        {
            base.OnInit();

            m_btnGmPanel   = Make <GameButton>("Button");
            this.m_gmPanel = Make <GMMainPanel>("Panel");
        }
コード例 #9
0
        protected override void OnInit()
        {
            base.OnInit();

            m_title_root     = this.Make <GameUIComponent>("Image");
            m_title_txt      = m_title_root.Make <GameLabel>("Text");
            m_title_txt.Text = string.Format("{0}!", LocalizeModule.Instance.GetString("recharge_title").ToUpper());
            m_title_effect   = m_title_root.Make <GameUIEffect>("UI_dengjishengji_01");
            m_title_effect.EffectPrefabName = "UI_dengjishengji_01.prefab";


            m_lvl_root       = this.Make <GameUIComponent>("Lvl_Root");
            m_from_lvl_txt   = m_lvl_root.Make <GameLabel>("Panel:Text (1)");
            m_to_lvl_txt     = m_lvl_root.Make <GameLabel>("Panel:Text (2)");
            m_lvl_slider     = m_lvl_root.Make <GameProgressBar>("Image_energy:Slider");
            m_cur_vit_txt    = m_lvl_root.Make <GameLabel>("Image_energy:Text_number");
            m_max_vit_txt    = m_lvl_root.Make <GameLabel>("Image_energy:Text_number_max");
            m_lvl_bar_effect = m_lvl_root.Make <GameUIEffect>("Image_energy:UI_tili_zengjia");
            m_lvl_bar_effect.EffectPrefabName = "UI_tili_zengjia.prefab";
            m_lvl_effect = m_lvl_root.Make <GameUIEffect>("Panel:UI_dengjishengji_02");
            m_lvl_effect.EffectPrefabName = "UI_dengjishengji_02.prefab";

            m_grid = this.Make <GameUIContainer>("Scroll View:Viewport");

            m_ok_btn    = this.Make <GameButton>("btnSure");
            m_btn_title = m_ok_btn.Make <GameLabel>("Text");
        }
コード例 #10
0
        private void InitController()
        {
            this.m_sumBgImg   = Make <GameImage>("Image:sumBg");
            m_icon_img        = Make <GameImage>("Image:icon");
            m_count_lab       = Make <GameLabel>("Image:sum");
            m_itemName_lab    = Make <GameLabel>("Image:title");
            m_itemContent_lab = Make <GameLabel>("Image:content");

            m_NumberRoot = Make <GameImage>("Imagenumber");
            m_reduce_btn = Make <GameButton>("Imagenumber:btnReduce");
            m_add_btn    = Make <GameButton>("Imagenumber:btnAdd");
            m_number_lab = Make <GameLabel>("Imagenumber:Text");

            m_disCount_img = Make <GameImage>("Image:Image");
            m_disCount_lab = m_disCount_img.Make <GameLabel>("Text");

            m_limit_root = Make <GameLabel>("Imagenumber:income");
            m_limit_lab  = m_limit_root.Make <GameLabel>("number");

            m_buy_btn      = Make <GameButton>("btn_buy");
            m_cashType_img = m_buy_btn.Make <GameImage>("Image");

            m_price_lab    = m_buy_btn.Make <GameLabel>("Text");
            m_oriRoot_root = Make <GameLabel>("Text");
            m_oriPrice_lab = m_oriRoot_root.Make <GameLabel>("Text_number");
            m_buy_Effect   = m_buy_btn.Make <GameUIEffect>("UI_goumai_anniu");
        }
コード例 #11
0
        protected override void OnInit()
        {
            base.OnInit();
            this.m_btn        = Make <GameButton>(gameObject);
            this.m_panelRoot  = Make <GameImage>("Panel");
            this.m_sceneImg   = new BuidTopSceneIcon[8];
            this.m_normalIcon = Make <GameImage>("Image");
            //this.m_lockIcon = Make<GameImage>("Image_Lock");
            //this.m_canLockIcon = Make<GameImage>("Image_CanLock");
            this.m_normalIcon.Visible = false;
            //this.m_lockIcon.Visible = false;
            //this.m_canLockIcon.Visible = false;
            this.m_lockeffect   = Make <GameUIEffect>("lockEffect");
            this.m_unLockEffect = Make <GameUIEffect>("unLockEffect");
            this.m_imgDownload  = Make <GameImage>("ImageDownload");
            //this.m_sceneOutLightingEffect = Make<GameUIEffect>("UI_faliang");
            for (int i = 0; i < 8; i++)
            {
                this.m_sceneImg[i] = Make <BuidTopSceneIcon>("scence_" + i);

                //this.m_sceneImg[i].SetData(m_achorData);
                this.m_sceneImg[i].Visible = false;
            }
            this.m_panelRoot.Visible = true;
        }
コード例 #12
0
ファイル: InputMapper.cs プロジェクト: Thaigun/PoPProject
    public bool GetKey(GameButton btn)
    {
        switch (btn)
        {
        case GameButton.Left:
            return(Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow));

        case GameButton.Right:
            return(Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow));

        case GameButton.Up:
            return(Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow));

        case GameButton.Down:
            return(Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow));

        case GameButton.Shift:
            return(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift));

        case GameButton.Restart:
            return(Input.GetKey(KeyCode.R) || Input.GetKey(KeyCode.Escape));

        default:
            return(false);
        }
    }
コード例 #13
0
ファイル: InputController.cs プロジェクト: smallant/newbark
        public InputAction ButtonToAction(GameButton button)
        {
            switch (button)
            {
            case GameButton.Up:
            case GameButton.Down:
            case GameButton.Left:
            case GameButton.Right:
                return(Actions.ButtonDirectional);

            case GameButton.A:
                return(Actions.ButtonA);

            case GameButton.B:
                return(Actions.ButtonB);

            case GameButton.Start:
                return(Actions.ButtonStart);

            case GameButton.Select:
                return(Actions.ButtonSelect);

            default:
                return(null);
            }
        }
コード例 #14
0
ファイル: UIAdjustWnd.cs プロジェクト: WeeirJoe/Joe
    void RefreshUI()
    {
        GameButton[] buttons = WndObject.GetComponentsInChildren <GameButton>();
        for (int i = 1; i < buttons.Length; i++)
        {
            if (GameStateMgr.Ins.gameStatus.HasUIAnchor[i - 1])
            {
                buttons[i].GetComponent <RectTransform>().anchoredPosition = GameStateMgr.Ins.gameStatus.UIAnchor[i - 1];
            }
            float scale = GameStateMgr.Ins.gameStatus.UIScale[i - 1];
            buttons[i].GetComponent <RectTransform>().localScale = new Vector3(scale, scale, 1);
        }
        float joyScale = GameStateMgr.Ins.gameStatus.JoyScale;

        Control("JoyArrow").GetComponent <RectTransform>().localScale       = new Vector3(joyScale, joyScale, 1);
        Control("JoyArrow").GetComponent <RectTransform>().anchoredPosition = GameStateMgr.Ins.gameStatus.JoyAnchor;

        //透明度设定
        Control("AlphaSliderBar").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.UIAlpha;

        //方向键缩放
        Control("JoyScale").GetComponent <Slider>().value = GameStateMgr.Ins.gameStatus.JoyScale;

        //功能键缩放,需要先选择按键后
        Control("ButtonScale").GetComponent <Slider>().value = 1;
        Control("ButtonScale").GetComponent <Slider>().onValueChanged.AddListener(OnButtonScaleChange);
        Control("ButtonScale").GetComponent <Slider>().enabled = false;
        SelectButton = null;
        SelectIndex  = -1;
    }
コード例 #15
0
 protected override void OnInit()
 {
     base.OnInit();
     this.m_nextBtn   = Make <GameButton>("Image_bg_2");
     this.m_pageLabel = Make <GameLabel>("Text_pagenumber");
     this.m_skipBtn   = Make <GameButton>("BtnSkip");
 }
コード例 #16
0
        private Keys ButtonToKey(GameButton button)
        {
            switch (button)
            {
            case GameButton.Dash: return(Configuration.Dash);

            case GameButton.Jump: return(Configuration.Jump);

            case GameButton.Menu: return(Configuration.Menu);

            case GameButton.Shoot: return(Configuration.Shoot);

            case GameButton.MoveDown: return(Configuration.MoveDown);

            case GameButton.MoveLeft: return(Configuration.MoveLeft);

            case GameButton.MoveRight: return(Configuration.MoveRight);

            case GameButton.MoveUp: return(Configuration.MoveUp);

            case GameButton.ToggleMusic: return(Configuration.ToggleMusic);

            default: throw new Exception("GameButton not mapped to Key.");
            }
        }
コード例 #17
0
        public bool IsPressed(GameButton button)
        {
            Keys key = ButtonToKey(button);

            return(_currentKBState.IsKeyUp(key) &&
                   _lastFrameKBState.IsKeyDown(key));
        }
コード例 #18
0
        public void CreateButtons(Panel panel, MouseEventHandler eventHandler, int gameFieldWidth, int gameFieldHeight)
        {
            int windowLocationHeight = ButtonSettings.WindowLocationHeight;

            for (int row = 0; row < gameFieldWidth; row++)
            {
                int windowLocationWidth = ButtonSettings.WindowLocationWidth;

                for (int col = 0; col < gameFieldHeight; col++)
                {
                    GameButton newButton =
                        this.ButtonFactory.CreateButton(windowLocationWidth, windowLocationHeight, row, col) as
                        GameButton;
                    if (newButton == null)
                    {
                        continue;
                    }

                    newButton.MouseUp  += eventHandler;
                    windowLocationWidth = newButton.Right;

                    panel.Controls.Add(newButton);
                    this.Database.AddButton(newButton, row, col);
                }

                windowLocationHeight += ButtonSettings.ButtonSizeWidth;
            }
        }
コード例 #19
0
        private void OnButtonChange(GameButton gameBtn, JoyAxis axis)
        {
            //change the option.
            if (gameBtn == GameButton.moveforward)
            {
                FrameworkCore.options.joyMoveForwardAxis = (int)axis;
            }
            else if (gameBtn == GameButton.movestrafe)
            {
                FrameworkCore.options.joyMoveStrafeAxis = (int)axis;
            }
            else if (gameBtn == GameButton.lookhoriz)
            {
                FrameworkCore.options.joyLookStrafeAxis = (int)axis;
            }
            else if (gameBtn == GameButton.lookvert)
            {
                FrameworkCore.options.joyLookForwardAxis = (int)axis;
            }

            //change the menu item's text.
            if (selectedItem != null)
            {
                selectedItem.optionText = GetAxisName(axis);
            }

            //close the popup.
            waitingForInput = false;

            FrameworkCore.PlayCue(sounds.click.activate);
        }
コード例 #20
0
 protected override void OnInit()
 {
     base.OnInit();
     this.m_btnReward       = Make <GameButton>("btn_receive");
     this.m_imgActivityBg   = Make <GameTexture>("RawImage_gift");
     this.m_btnActivityTips = Make <GameButton>("Button_detail");
 }
コード例 #21
0
        public static void RegisterWindow(GameWindow window)
        {
            if (window.IsDestroyed)
            {
                throw new Exception("Window is destroyed: " + window);
            }

            if (openedWindows.Contains(window))
            {
                return;
            }

            openedWindows.Add(window);
            BringToFront(window);
            window.Open();

            // ReSharper disable once CanExtractXamlLocalizableStringCSharp
            window.CloseByEscapeKeyInputContext
                = ClientInputContext.Start("Close window")
                  .HandleAll(
                      () =>
            {
                const GameButton button = GameButton.CancelOrClose;
                if (ClientInputManager.IsButtonDown(button) &&
                    window.CloseByEscapeKey)
                {
                    window.Close(DialogResult.Cancel);
                    ClientInputManager.ConsumeButton(button);
                }
            });
        }
コード例 #22
0
ファイル: MainMenu.cs プロジェクト: meckyr/NursaRhythm
        public override void Initialize()
        {
            bg = new GameSprite("menu\\background");
            AddSceneObject(bg);

            scroll = new GameSprite("menu\\scroll");
            AddSceneObject(scroll);

            play        = new GameButton("menu\\explore", true, false, true);
            play.Color  = Color.White * 0.1f;
            play.Origin = new Vector2(216.5f, 55);
            play.Translate(400, 130);
            play.OnClick += () =>
            {
                SceneManager.push.Play();
                SceneManager.SetActiveScene("LevelSelect");
                SceneManager.ActiveScene.ResetScene();
            };
            AddSceneObject(play);

            setting        = new GameButton("menu\\settings", true, false, true);
            setting.Color  = Color.White * 0.1f;
            setting.Origin = new Vector2(148, 37.5f);
            setting.Translate(400, 235);
            setting.OnClick += () =>
            {
                SceneManager.push.Play();
                SceneManager.SetActiveScene("OptionScene");
                SceneManager.ActiveScene.ResetScene();
            };
            AddSceneObject(setting);

            codex        = new GameButton("menu\\archive", true, false, true);
            codex.Color  = Color.White * 0.1f;
            codex.Origin = new Vector2(148, 46);
            codex.Translate(400, 350);
            codex.OnClick += () =>
            {
                SceneManager.push.Play();
                SceneManager.SetActiveScene("Archive");
                SceneManager.ActiveScene.ResetScene();
            };
            AddSceneObject(codex);

            decor1        = new GameAnimatedSprite("menu\\decor", 9, 80, new Point(441, 39), 1);
            decor1.Color  = Color.White * 0.1f;
            decor1.Origin = new Vector2(220.5f, 19.5f);
            decor1.Translate(400, 50);
            decor1.PlayAnimation(true);
            AddSceneObject(decor1);

            decor2        = new GameAnimatedSprite("menu\\decor", 9, 80, new Point(441, 39), 1);
            decor2.Color  = Color.White * 0.1f;
            decor2.Origin = new Vector2(220.5f, 19.5f);
            decor2.Translate(400, 430);
            decor2.PlayAnimation(true);
            AddSceneObject(decor2);

            base.Initialize();
        }
コード例 #23
0
        private void InitController()
        {
            m_icon_img  = Make <GameImage>("icon");
            m_effect    = m_icon_img.Make <GameUIEffect>("UI_zengjiatili");
            m_count_BG  = m_icon_img.Make <GameImage>("Image");
            m_count_lab = m_count_BG.Make <GameLabel>("count");

            m_disCount_root = m_icon_img.Make <GameImage>("Image_label");
            m_disCount_lab  = m_disCount_root.Make <GameLabel>("Text");
            m_oriPrice_root = m_icon_img.Make <GameImage>("Image_original");
            m_oriPrice_lab  = m_oriPrice_root.Make <GameLabel>("Text_number");

            m_use_btn = Make <GameButton>("btnUse");

            m_buy_btn = Make <GameButton>("btnbuy");
            //m_buy_title_txt = m_buy_btn.Make<GameLabel>("Text_cost");
            //m_buy_title_txt.Text = LocalizeModule.Instance.GetString("goods_buy");
            m_cost_lab     = m_buy_btn.Make <GameLabel>("Text_cost");
            m_cashType_img = m_buy_btn.Make <GameImage>("Image_cash");


            m_limited_buy_btn = Make <GameButton>("limitedbuy");
            //m_limited_buy_title_txt = m_limited_buy_btn.Make<GameLabel>("Text");
            //m_limited_buy_title_txt.Text = LocalizeModule.Instance.GetString("goods_buy");
            m_limited_cost_lab     = m_limited_buy_btn.Make <GameLabel>("Text_cost");
            m_limited_cashType_img = m_limited_buy_btn.Make <GameImage>("Image_cash");
            m_limited_buy_num_txt  = m_limited_buy_btn.Make <GameLabel>("Image_label_1:Text");
        }
コード例 #24
0
 private void AddKey(GameButton key)
 {
     if (!_GameButtons.Contains(key))
     {
         _GameButtons.Add(key);
     }
 }
コード例 #25
0
        public GameButton GetLastButtonClick(out int x, out int y)
        {
            GameButton button = GameButton.None;

            x = 0;
            y = 0;

            if (_buttonClicked)
            {
                if (_buttonClicked == _quitButton)
                {
                    button = GameButton.Quit;
                }
                else if (_buttonClicked == _resetButton)
                {
                    button = GameButton.Reset;
                }
                else
                {
                    int gridButtonIndex = Array.IndexOf(_gridButtons, _buttonClicked);

                    if (gridButtonIndex != -1)
                    {
                        button = GameButton.Grid;

                        x = gridButtonIndex % 3;
                        y = gridButtonIndex / 3;
                    }
                }
            }

            return(button);
        }
コード例 #26
0
 protected override void OnInit()
 {
     base.OnInit();
     m_grid_com  = Make <GameUIContainer>("Panel:Panel_prop:grid");
     m_close_btn = Make <GameButton>("Button_close");
     //this.tweener = Transform.GetComponentsInChildren<UITweener>(true);
 }
コード例 #27
0
        protected override void OnInit()
        {
            base.OnInit();

            m_name_txt = Make <GameLabel>("Panel_down:Image_sence:Text_Name");
            m_desc_txt = Make <GameLabel>("Panel_down:Image_sence:Text_Desc");
            m_tips_txt = Make <GameLabel>("Panel_down:Image_sence:Text_Tips");
            m_completeTaskTipsLabel = Make <GameUIComponent>("Panel_down:Image_sence:Text_missioncomplete");
            m_tips_btn      = Make <GameUIComponent>("Panel_down:Image_sence:Btn_Tips");
            m_reward_root   = Make <GameUIComponent>("Panel_down:Image_sence:Image (1):ScrollView");
            m_aim_grid      = Make <GameUIContainer>("Panel_down:Image_sence:Image (2):ScrollView (1):Viewport"); //IconNameNumItemView
            m_reward_grid   = Make <GameUIContainer>("Panel_down:Image_sence:Image (1):ScrollView:Viewport");     //DropItemIcon
            m_title_txt     = Make <GameLabel>("Panel_down:Image_sence:Image (1):Text");
            m_titleGet      = m_title_txt.Make <GameUIComponent>("Image");
            m_btn           = Make <GameButton>("Panel_down:Button_action");
            m_close_btn     = Make <GameButton>("Button_close");
            this.m_btnLable = this.m_btn.Make <GameLabel>("Text");
            //m_bg_img = Make<GameImage>("RawImage");
            //m_bg_tween_alpha = m_bg_img.GetComponent<TweenAlpha>();
            m_tween_root = Make <GameUIComponent>("Panel_down");
            //var tween_poses = m_tween_root.GetComponents<TweenPosition>().Where((i) => UITweenerBase.TweenTriggerType.Manual == i.m_triggerType);
            //m_hide_tween_pos = tween_poses.First();
            //m_hide_tween_scale = m_tween_root.GetComponent<TweenScale>();
            //m_hide_tween_alpha = m_tween_root.GetComponents<TweenAlpha>().Where((i) => UITweenerBase.TweenTriggerType.OnHide == i.m_triggerType).First();
            //m_hide_tween_scale.AddTweenCompletedCallback(ScaleTweenFinished);
            m_tween_root.gameObject.transform.localScale = Vector3.one;
        }
コード例 #28
0
        private void newButtonClicked(GameButton button)
        {
            Debug.Assert(activeButtons.Count <= 1);
            button.SetVisible(true);

            if (activeButtons.Count == 0)
            {
                activeButtons.Add(button);
            }
            else if (activeButtons.Count == 1)
            {
                if (activeButtons[0] == button)
                {
                    return;
                }
                if (activeButtons[0].Num != button.Num)
                {
                    button.Update();
                    System.Threading.Thread.Sleep(500);
                    activeButtons[0].SetVisible(false);
                    button.SetVisible(false);
                }
                else
                {
                    activeButtons[0].Enabled = false;
                    button.Enabled           = false;
                }
                activeButtons.Clear();
            }
        }
コード例 #29
0
        public InventoryMenu(Rectangle elementRectangle, GameSession gameSession) : base(elementRectangle)
        {
            this.gameSession = gameSession;

            SetMenu(new IMenuElementData[] { GameButton.BackButtonData(gameSession) }, SCREEN_HEIGHT_PORTION);
            AddElement(new InventoryPanel(new Rectangle(elementRectangle.X, elementRectangle.Y, elementRectangle.Width, (int)Math.Floor(elementRectangle.Height * SCREEN_HEIGHT_PORTION))));
        }
コード例 #30
0
 private void ChooseScenario(GameButton button, object scenario)
 {
     var sc = scenario as Scenario;
     if (sc != null) {
         MainGame.EVENT_BUS.Post(new ScenarioChoosenEvent(this, sc));
     }
 }
コード例 #31
0
        //private UITweenerBase[] tweener = null;
        protected override void OnInit()
        {
            m_bg     = Make <GameImage>("Image_back");
            m_text01 = Make <GameLabel>("Text_1");
            m_text02 = Make <GameLabel>("Text_2");

            m_sliderBtnBackgroundMusic = Make <GameSliderButton>("Toggle_1");
            UITweenerBase[] UITweeners = m_sliderBtnBackgroundMusic.gameObject.GetComponentsInChildren <UITweenerBase>(true);
            foreach (var ut in UITweeners)
            {
                ut.ResetAndPlay();
            }

            m_sliderBtnSound = Make <GameSliderButton>("Toggle_2");

            UITweeners = m_sliderBtnSound.gameObject.GetComponentsInChildren <UITweenerBase>(true);
            foreach (var ut in UITweeners)
            {
                ut.ResetAndPlay();
            }

            m_btnContinue          = Make <GameButton>("Button_continue");
            m_btnQuit              = Make <GameButton>("Button_quit");
            this.m_btnContinueOnly = Make <GameButton>("Button_continue_Guid");

            m_backgroundTexture         = Make <GameImage>("RawImage");
            m_sceneMask                 = Make <GameUIComponent>("sceneMask");
            m_backgroundTexture.Visible = false;
            m_sceneMask.Visible         = false;
            //this.tweener = Transform.GetComponentsInChildren<UITweenerBase>(false);
        }
コード例 #32
0
        private void OnButtonChange(GameButton gameBtn, int buttonNumber)
        {
            if (gameBtn == GameButton.confirm)
            {
                FrameworkCore.options.joyConfirm = buttonNumber;
            }
            else if (gameBtn == GameButton.cancel)
            {
                FrameworkCore.options.joyCancel = buttonNumber;
            }
            else if (gameBtn == GameButton.altA)
            {
                FrameworkCore.options.joyAltA = buttonNumber;
            }
            else if (gameBtn == GameButton.giveToAlly)
            {
                FrameworkCore.options.joyGiveToAlly = buttonNumber;
            }
            else if (gameBtn == GameButton.prev)
            {
                FrameworkCore.options.joyPrev = buttonNumber;
            }
            else if (gameBtn == GameButton.next)
            {
                FrameworkCore.options.joyNext = buttonNumber;
            }
            else if (gameBtn == GameButton.camReset)
            {
                FrameworkCore.options.joyCamReset = buttonNumber;
            }
            else if (gameBtn == GameButton.openMenu)
            {
                FrameworkCore.options.joyOpenMenu = buttonNumber;
            }
            else if (gameBtn == GameButton.turbo)
            {
                FrameworkCore.options.joyTurbo = buttonNumber;
            }
            else if (gameBtn == GameButton.climb)
            {
                FrameworkCore.options.joyClimb = buttonNumber;
            }
            else if (gameBtn == GameButton.lower)
            {
                FrameworkCore.options.joyLower = buttonNumber;
            }



            if (selectedItem != null)
            {
                selectedItem.optionText = GetButtonName(buttonNumber);
            }


            waitingForInput = false;

            FrameworkCore.PlayCue(sounds.click.activate);
        }
コード例 #33
0
        public void Create(List<UiElement> components, List<UiElement> modalComponents)
        {
            components.Clear();
            modalComponents.Clear();

            var panel = new GamePanel(Consts.SCREEN_WIDTH, Consts.STATUS_BAR_HEIGHT + 1);
            components.Add(panel);

            var textBox = new GameTextBox(new PointF(20, 20)) { Text = "hello, editor!" };
            modalComponents.Add(textBox);
            var checkBox = new GameCheckBox(new PointF(20, 27)) {Caption = "Typical CheckBox"};
            modalComponents.Add(checkBox);

            var newMapBtn = new GameButton(new PointF(5, 1.5f), "New Map");
            newMapBtn.OnClick += () =>
            {
                LayoutManager.GetManager().HasFocus = true;
                textBox.HasFocus = true;
                LayoutManager.GetManager().IsShowingModal = true;
            };
            components.Add(newMapBtn);

            var btnPos = newMapBtn.Position;
            btnPos.X += Consts.BUTTON_WIDTH + 3;
            var loadMapBtn = new GameButton(btnPos, "Load Map");
            loadMapBtn.OnClick += () =>
            {

                LayoutManager.GetManager().IsShowingModal = true;
            };
            components.Add(loadMapBtn);

            btnPos.X += Consts.BUTTON_WIDTH + 3;
            var saveMapBtn = new GameButton(btnPos, "SaveMap") { Enabled = false };
            saveMapBtn.OnClick += () =>
            {
                LayoutManager.GetManager().IsShowingModal = true;
            };
            components.Add(saveMapBtn);

            btnPos.X = Consts.SCREEN_WIDTH - Consts.BUTTON_WIDTH - 1;
            var backToMenuBtn = new GameButton(btnPos, "Return");
            backToMenuBtn.OnClick += () =>
            {
                LayoutManager.GetManager().ScreenType = ScreenType.MainMenu;
                LayoutManager.GetManager().SetComponents(ScreenType.MainMenu);
            };
            components.Add(backToMenuBtn);
        }
コード例 #34
0
ファイル: InputManager.cs プロジェクト: zunath/MMXEngine
 private Keys ButtonToKey(GameButton button)
 {
     switch (button)
     {
         case GameButton.Dash: return Configuration.Dash;
         case GameButton.Jump: return Configuration.Jump;
         case GameButton.Menu: return Configuration.Menu;
         case GameButton.Shoot: return Configuration.Shoot;
         case GameButton.MoveDown: return Configuration.MoveDown;
         case GameButton.MoveLeft: return Configuration.MoveLeft;
         case GameButton.MoveRight: return Configuration.MoveRight;
         case GameButton.MoveUp: return Configuration.MoveUp;
         default: throw new Exception("GameButton not mapped to Key.");
     }
 }
コード例 #35
0
ファイル: InputManager.cs プロジェクト: kuuri/tohoSRPG
 static bool GetPadButtonState(GameButton order, GamePadState pad)
 {
     switch (order)
     {
         case GameButton.Up:
             return pad.ThumbSticks.Left.Y > 0.2 || pad.IsButtonDown(Buttons.DPadUp);
         case GameButton.Down:
             return pad.ThumbSticks.Left.Y < -0.2 || pad.IsButtonDown(Buttons.DPadDown);
         case GameButton.Right:
             return pad.ThumbSticks.Left.X > 0.2 || pad.IsButtonDown(Buttons.DPadRight);
         case GameButton.Left:
             return pad.ThumbSticks.Left.X < -0.2 || pad.IsButtonDown(Buttons.DPadLeft);
         default:
             return pad.IsButtonDown(buttonsPad[order]);
     }
 }
コード例 #36
0
ファイル: GameUICreator.cs プロジェクト: CSF-VSU/SpacePewPew
        public void Create(List<UiElement> components, List<UiElement> modalComponents)
        {
            components.Clear();
            modalComponents.Clear();

            components.Add(new PlayerInfoStatusBar());

            var saveBtn = new GameButton(new PointF(140, 1), "Save");
            saveBtn.OnClick += () => Game.Instance().Manager.SaveGame(Game.Instance());
            components.Add(saveBtn);

            var endTurnBtn = new GameButton(new PointF(160, 1), "End Turn");
            endTurnBtn.OnClick += () => Game.Instance().PassTurn();
            components.Add(endTurnBtn);

            var listViewPos = new PointF(20, Consts.STATUS_BAR_HEIGHT + 1);
            var data = new List<ListViewItemData>
                       {
                           new ListViewItemData {GlyphNum = 6, Appendix = "20", Text = "Fighter"},
                           new ListViewItemData {GlyphNum = 3, Appendix = "30", Text = "Barge"},
                           new ListViewItemData {GlyphNum = 14, Appendix = "18", Text = "Healer"},
                           new ListViewItemData {GlyphNum = 17, Appendix = "20", Text = "Infestor"}
                       };
            var listView = new GameListView.ListView(listViewPos, data, 4);
            modalComponents.Add(listView);

            var quitShopBtn = new GameButton(new PointF(70, 87), "Quit Shop");
            quitShopBtn.OnClick += () =>
            {
                listView.Index = -1;
                LayoutManager.GetManager().IsShowingModal = false;
            };
            modalComponents.Add(quitShopBtn);

            var pos = quitShopBtn.Position;
            pos.X -= Consts.BUTTON_WIDTH + 2;

            var buyShipBtn = new GameButton(pos, "Buy Ship");
            buyShipBtn.OnClick += () =>
            {
                Game.Instance().BuildShip(listView.Index);
                listView.Index = -1;
                LayoutManager.GetManager().IsShowingModal = false;
            };
            modalComponents.Add(buyShipBtn);
        }
コード例 #37
0
ファイル: InputManager.cs プロジェクト: kuuri/tohoSRPG
        static void CheckOrder(GameButton o, KeyboardState key, GamePadState pad)
        {
            bool keybool;
            keybool = key.IsKeyDown(buttonsKey[o]);

            if (keybool || GetPadButtonState(o, pad))
            {
                if (order[o] == ButtonState.Free || order[o] == ButtonState.Pull)
                    order[o] = ButtonState.Push;
                else
                    order[o] = ButtonState.Hold;
            }
            else
            {
                if (order[o] == ButtonState.Free || order[o] == ButtonState.Pull)
                    order[o] = ButtonState.Free;
                else
                    order[o] = ButtonState.Pull;
            }
        }
コード例 #38
0
        public void Create(List<UiElement> components, List<UiElement> modalComponents)
        {
            components.Clear();
            modalComponents.Clear();

            var newGameBtn = new GameButton(new PointF(157, 50), "New Game");
            newGameBtn.OnClick += () =>
            {
                LayoutManager.GetManager().ScreenType = ScreenType.Game;
                LayoutManager.GetManager().SetComponents(ScreenType.Game);
                Game.Instance().StartNewGame();
            };
            components.Add(newGameBtn);

            var pos = newGameBtn.Position;
            pos.Y += Consts.BUTTON_HEIGHT + 5;
            var loadGameBtn = new GameButton(pos, "Load Game");
            loadGameBtn.OnClick += () =>
            {
                Game.Instance().Manager.LoadGame();
                LayoutManager.GetManager().ScreenType = ScreenType.Game;
                LayoutManager.GetManager().SetComponents(ScreenType.Game);
            };
            components.Add(loadGameBtn);

            pos.Y += Consts.BUTTON_HEIGHT + 5;
            var editorBtn = new GameButton(pos, "Editor");
            editorBtn.OnClick += () =>
            {
                LayoutManager.GetManager().ScreenType = ScreenType.Editor;
                LayoutManager.GetManager().SetComponents(ScreenType.Editor);
            };
            components.Add(editorBtn);

            pos.Y += Consts.BUTTON_HEIGHT + 5;
            var exitBtn = new GameButton(pos, "Exit");
            exitBtn.OnClick += Application.Exit;
            components.Add(exitBtn);
        }
コード例 #39
0
 public GameAction(GameButton button)
 {
     _Button = button;
 }
コード例 #40
0
ファイル: MapScreen.cs プロジェクト: GooDer/descent
 public void DialogCloseAction(GameButton source, object sourceObject)
 {
     if (combatDialog != null)
     {
         combatDialog.Hide();
         OnFocus();
     }
 }
コード例 #41
0
 private void ChooseNumberOfHeroes(GameButton button, object numOfHeroes)
 {
     MainGame.EVENT_BUS.Post(new NumOfHeroesChoosenEvent(this, (int)numOfHeroes));
 }
コード例 #42
0
ファイル: ChooseHerosScreen.cs プロジェクト: GooDer/descent
        private void OnFocus(GameButton source, object sourceObj)
        {
            Hero hero = sourceObj as Hero;
            IHeroClass heroClass = sourceObj as IHeroClass;

            if (hero != null)
            {
                FocusedImages.Add(ImageProvider.Instance.GetImage(hero.GetHeroSheet()));
            }
            else if (heroClass != null)
            {
                foreach (var item in heroClass.getClassEquipment())
                {
                    FocusedImages.Add(ImageProvider.Instance.GetImage(item.GetImage()));
                }
            }
        }
コード例 #43
0
ファイル: Screen.cs プロジェクト: GooDer/descent
 public void AddButton(GameButton button)
 {
     button.Show();
     buttons.Add(button);
 }
コード例 #44
0
ファイル: User.cs プロジェクト: ozzyonfire/CircleOfLife
        //The following builds and initializes the games gui's seperated from the user class mainly for organizational purposes
        public void initializeGameScreen()
        {
            menuButton = new GameButton(new UniRectangle(
                    new UniScalar(0.11f, 0.0f),
                    new UniScalar(0.91f, 0.0f),
                    new UniScalar(0.09f, 0.0f),
                    new UniScalar(0.09f, 0.0f)),
                    baseGame.spriteSheet, new RectangleF(
                        Sprites.menuButton.X,
                        Sprites.menuButton.Y,
                        Sprites.menuButton.Width,
                        Sprites.menuButton.Height));
                menuButton.hoverSourceRect = new RectangleF(
                        Sprites.menuButton.X + 150,
                        Sprites.menuButton.Y,
                        Sprites.menuButton.Width,
                        Sprites.menuButton.Height);

                menuButton.Text = "Menu";
                menuButton.Pressed += new EventHandler(menuButton_Pressed);

                addButton = new GameButton(new UniRectangle(
                        new UniScalar(0.0f, 0.0f),
                        new UniScalar(0.91f, 0.0f),
                        new UniScalar(0.09f, 0.0f),
                        new UniScalar(0.09f, 0.0f)),
                        baseGame.spriteSheet, new RectangleF(
                            Sprites.addButton.X,
                            Sprites.addButton.Y,
                            Sprites.addButton.Width,
                            Sprites.addButton.Height));
                addButton.hoverSourceRect = new RectangleF(
                        Sprites.addButton.X + 150,
                        Sprites.addButton.Y,
                        Sprites.addButton.Width,
                        Sprites.addButton.Height);

                addButton.Text = "Add";
                addButton.Pressed += new EventHandler(addButton_Pressed);

                gameScreen.Desktop.Children.Add(addButton);
                gameScreen.Desktop.Children.Add(menuButton);
        }
コード例 #45
0
ファイル: ChooseHerosScreen.cs プロジェクト: GooDer/descent
        private void OnClassChoose(GameButton source, object heroClass)
        {
            source.SetDisabled(true);
            actualHero.SetHeroClass((IHeroClass)heroClass);

            if (heroes.Count == NumOfHeroes)
            {
                MainGame.EVENT_BUS.Post(new HeroesChoosenEvent(this, heroes));
            }
            else
            {
                subScreen = SubScreen.CLASS_SCREEN;
                FocusedImages.Clear();
                InitHeroScreen();
            }
        }
コード例 #46
0
 // Methods
 public ClickButton(byte[] data)
     : base(data)
 {
     this.button = (GameButton) BitConverter.ToUInt32(data, 1);
     this.complement = BitConverter.ToUInt16(data, 5);
 }
コード例 #47
0
 public static byte[] Build(GameButton button, ushort complement)
 {
     return new byte[] { 0x4f, ((byte) button), ((byte) (((int) button) >> 8)), ((byte) (((int) button) >> 0x10)), ((byte) (((int) button) >> 0x18)), ((byte) complement), ((byte) (complement >> 8)) };
 }
コード例 #48
0
ファイル: InputManager.cs プロジェクト: kuuri/tohoSRPG
 static public bool GetButtonStateAsBool(GameButton button)
 {
     if (order[button] == ButtonState.Push || order[button] == ButtonState.Hold)
         return true;
     else
         return false;
 }
コード例 #49
0
ファイル: InputManager.cs プロジェクト: kuuri/tohoSRPG
 static public bool GetButtonStateIsPush(GameButton button) { return order[button] == ButtonState.Push; }
コード例 #50
0
ファイル: InputManager.cs プロジェクト: kuuri/tohoSRPG
 static public ButtonState GetButtonState(GameButton button) { return order[button]; }
コード例 #51
0
ファイル: InputManager.cs プロジェクト: kuuri/tohoSRPG
 static public void ChangeButton(GameButton o, Buttons value)
 {
     if (buttonsPad.ContainsValue(value))
     {
         GameButton oldPos = new GameButton();
         oldPos = buttonsPad.FirstOrDefault(x => x.Value == value).Key;
         Buttons tmp = buttonsPad[o];
         buttonsPad[o] = value;
         buttonsPad[oldPos] = tmp;
     }
     else
         buttonsPad[o] = value;
 }
コード例 #52
0
ファイル: ButtonTests.cs プロジェクト: whztt07/DeltaEngine
		public void CreateButton()
		{
			var button = new GameButton("Wurm1", new Rectangle(0, 0, 0.5f, 0.5f));
			Assert.IsNotNull(button);
		}
コード例 #53
0
 public ClickButton(GameButton button, ushort complement)
     : base(Build(button, complement))
 {
     this.button = button;
     this.complement = complement;
 }
コード例 #54
0
        // eliminate redundant button press code by generalizing it here
        private void ProcessButton(GameButton button, bool pressed, double elapsed)
        {
            if (pressed)
            {
                // manage button repeats by tracking how long
                // this button has been pressed
                ButtonPressDuration[(int)button] += elapsed;

                // if the repeat rate has been exceeded, treat
                // this as a new button press
                if (ButtonPressDuration[(int)button] > BUTTON_REPEAT_RATE)
                {
                    ButtonPressDuration[(int)button] = elapsed;
                }

                // button was just pressed or has repeated
                if (ButtonPressDuration[(int)button] == elapsed)
                {
                    switch (button)
                    {
                        case GameButton.Up:
                            MoveCursor(CursorDirection.Up);
                            break;
                        case GameButton.Down:
                            MoveCursor(CursorDirection.Down);
                            break;
                        case GameButton.Left:
                            MoveCursor(CursorDirection.Left);
                            break;
                        case GameButton.Right:
                            MoveCursor(CursorDirection.Right);
                            break;
                        case GameButton.Fire:
                            if (CurrentState == GameState.GameOver)
                            {
                                // start a new game
                                Clear();
                                CenterCursor();
                                CurrentState = GameState.Playing;
                            }
                            else
                            {
                                // swap the currently-selected cells
                                SwapCells();
                            }
                            break;
                    }
                }
            }
            else
            {
                // button was released, reset counter
                ButtonPressDuration[(int)button] = 0;
            }
        }
コード例 #55
0
ファイル: MapScreenWidget.cs プロジェクト: GooDer/descent
        public void OnActionClick(GameButton source, object action)
        {
            IAction choosenAction = action as IAction;

            if (GameplayProgress.Instance.ActCharacter != null && choosenAction != null)
            {
                choosenAction.PerformActionOn(GameplayProgress.Instance.ActCharacter, GameplayProgress.Instance.Scenario);
                ShowPossibleActions(GameplayProgress.Instance.ActCharacter);
            }
        }
コード例 #56
0
ファイル: Controls.cs プロジェクト: 3dAnon/PoniGame
 /*
  * Returns true if any of the relevant keyboard or joystick buttons are held down.
  */
 public static bool IsDown(GameButton button)
 {
     BufferedButton bufferedButton = m_buttons[button];
     return !(m_isMuted && bufferedButton.CanBeMuted) && bufferedButton.IsDown();
 }
コード例 #57
0
ファイル: Controls.cs プロジェクト: 3dAnon/PoniGame
 /*
  * Returns true if a relevant keyboard or joystick key was released since the last appropriate update.
  */
 public static bool JustUp(GameButton button)
 {
     BufferedButton bufferedButton = m_buttons[button];
     bool isFixed = (Time.deltaTime == Time.fixedDeltaTime);
     return !(m_isMuted && bufferedButton.CanBeMuted) && (isFixed ? bufferedButton.JustUp() : bufferedButton.VisualJustUp());
 }
コード例 #58
0
ファイル: ChooseHerosScreen.cs プロジェクト: GooDer/descent
 private void OnHeroChoose(GameButton source, object hero)
 {
     source.SetDisabled(true);
     heroes.Add((Hero)hero);
     actualHero = (Hero)hero;
     subScreen = SubScreen.CLASS_SCREEN;
     FocusedImages.Clear();
     InitClassScreen();
 }
コード例 #59
0
ファイル: ButtonTests.cs プロジェクト: whztt07/DeltaEngine
		public void ShowClickableButton()
		{
			var button = new GameButton("Wurm1", new Rectangle(0, 0, 0.5f, 0.5f));
			button.Clicked += () => button.Alpha = button.Alpha == 1.0f ? 0.5f : 1.0f;
		}
コード例 #60
0
ファイル: InputManager.cs プロジェクト: zunath/MMXEngine
 public bool WasUpLastFrame(GameButton button)
 {
     Keys key = ButtonToKey(button);
     return _lastFrameKBState.IsKeyUp(key);
 }