Esempio n. 1
0
    void Start()
    {
        trackedObj         = GetComponent <SteamVR_TrackedObject>();
        source             = GetComponent <AudioSource>();
        playEasy           = easy.GetComponent <Image> ().sprite;
        playNormal         = normal.GetComponent <Image> ().sprite;
        playHard           = hard.GetComponent <Image> ().sprite;
        instructions       = instr.GetComponent <Image> ().sprite;
        buttons            = new GameButton[] { easy, normal, hard, instr };
        sprites            = new Sprite[] { playEasy, playNormal, playHard, instructions };
        spritesHighlighted = new Sprite[] { playEasyHighlighted, playNormalHighlighted, playHardHighlighted, instructionsHighlighted };
        i       = 0;
        onInstr = false;

        easy.GetComponent <Image> ().sprite = playEasyHighlighted;
    }
Esempio n. 2
0
        protected override void Initialize()
        {
            EnableButton(HardLevelsButton, Profile.Deluxe || Settings.Debug);
            EnableButton(MaxLevelsButton, false);

            RankingsButton.Enabled = false;
            RankingsButton.GetComponent <UITexture>().mainTexture = Resources.Load <Texture2D>(RankingsButton.Enabled ? "Images/UI/RankingsButton" : "Images/UI/RankingsButtonDisabled");
        }
Esempio n. 3
0
 void OnButtonScaleChange(float s)
 {
     if (SelectButton != null && SelectIndex > 0)
     {
         GameStateMgr.Ins.gameStatus.UIScale[SelectIndex - 1]   = s;
         SelectButton.GetComponent <RectTransform>().localScale = new Vector3(s, s, 1);
     }
 }
Esempio n. 4
0
 public override void Press()
 {
     source.PlayOneShot(click);
     playEasy.GetComponent <Image>().enabled     = true;
     playNormal.GetComponent <Image>().enabled   = true;
     playHard.GetComponent <Image>().enabled     = true;
     instructions.GetComponent <Image>().enabled = true;
     GetComponent <Image>().enabled = false;
     instructionsText.SetActive(false);
 }
Esempio n. 5
0
    //bool isPress = false;
    //Vector2 leftDown = UIHelper.ScreenPointToUIPoint(new Vector2(0, 0));
    //Vector2 leftUp = UIHelper.ScreenPointToUIPoint(new Vector2(0, Screen.height));

    public void OnChangeTarget(int uiIndex, GameButton active)
    {
        RectTransform rect = active == null ? null : active.GetComponent <RectTransform>();

        if (Target != null)
        {
            Target.GetComponent <CanvasGroup>().alpha = GameStateMgr.Ins.gameStatus.UIAlpha;
        }
        Target = rect;
        if (Target != null)
        {
            Target.GetComponent <CanvasGroup>().alpha = 1.0f;
        }
        UIIndex     = uiIndex;
        box.enabled = Target != null;
        if (Target == null)
        {
            vecOffset.x = vecOffset.y = 0;
        }
    }
Esempio n. 6
0
 private void EnableButton(GameButton button, bool enable)
 {
     button.Enabled = enable;
     button.GetComponent <UITexture>().mainTexture = Resources.Load <Texture2D>(enable ? "Images/UI/ButtonLong" : "Images/UI/ButtonLongInactive");
 }
Esempio n. 7
0
        private void InitController()
        {
            m_entry_Tog   = new GameButton[MAXPANEL];
            this.m_maskBG = Make <GameUIComponent>("MaskBG");
            //m_entry_tog_show_tween_pos = new List<TweenPosition>();
            //m_entry_tog_hide_tween_pos = new List<TweenPosition>();
            //m_entry_tog_tween_alpha = new List<TweenAlpha>();
            this.m_activityUI            = Make <GameUIComponent>("ActivityAnimator");
            this.m_entryBackground       = new GameImage[MAXPANEL];
            m_red_points                 = new Dictionary <string, GameImage>();
            this.m_bottomUI              = Make <GameUIComponent>("Panel_down");
            this.m_bottomButtonComponent = Make <GameUIComponent>("Panel_down:mask:grid");
            this.m_gridComponent         = this.m_bottomButtonComponent.Widget.GetComponent <UnityEngine.UI.GridLayoutGroup>();
            for (int i = 0; i < MAXPANEL; i++)
            {
                m_entry_Tog[i] = Make <GameButton>(string.Format("Panel_down:mask:grid:Toggle_{0}", i + 1));
#if OFFICER_SYS
                if (i == 2)
                {
                    m_newPoliceEffect = m_entry_Tog[i].Make <GameUIEffect>("newPolice");
                }
#endif
                GameImage img = m_entry_Tog[i].Make <GameImage>("ImgWarn");
                m_red_points[m_panelName[i]] = img;
                this.m_entryBackground[i]    = m_entry_Tog[i].Make <GameImage>(m_entry_Tog[i].gameObject);
                btnEntry(i);
            }

            m_entry_tog_show_tween_pos = this.m_bottomButtonComponent.GetComponent <TweenPosition>();
            m_entry_tog_tween_alpha    = this.m_bottomButtonComponent.GetComponent <TweenAlpha>();
            m_entry_tog_show_tween_pos.SetTweenCompletedCallback(() => EnableBottomButtons(true));

            m_hide_btn              = Make <GameButton>("Panel_down:Button_hide");
            m_menuBtnTweener        = m_hide_btn.GetComponent <TweenRotationEuler>();
            m_btnSwitchRedPointMark = m_hide_btn.Make <GameImage>("ImgWarn");

            m_playerTaskPanelComponent             = Make <PlayerTaskComponent>("Panel_Task");
            this.m_taskPanel                       = m_playerTaskPanelComponent.Make <GameUIComponent>("Panel");
            m_activity_btn                         = Make <GameButton>("ActivityAnimator:Button_activities");
            m_activity_btn_effect                  = Make <GameUIEffect>("ActivityAnimator:Button_activities:UI_huodong_02");
            m_activity_btn_effect.EffectPrefabName = "UI_huodong_02.prefab";
            m_ActivityRedPoint                     = m_activity_btn.Make <GameImage>("ImgWarn");

#if OFFICER_SYS
            m_remove_red_points = new Dictionary <string, SafeAction>()
            {
                { m_panelName[0], GameEvents.RedPointEvents.Sys_OnNewEmailReadedEvent },
                { m_panelName[1], null },
                { m_panelName[2], null },
                { m_panelName[3], null },
                { m_panelName[4], GameEvents.RedPointEvents.Sys_OnNewAchievementReadedEvent },
                { m_panelName[5], null },
                { m_panelName[6], null /*GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent*/ },
            };
#else
            m_remove_red_points = new Dictionary <string, SafeAction>()
            {
                { m_panelName[0], GameEvents.RedPointEvents.Sys_OnNewEmailReadedEvent },
                { m_panelName[1], null },
                { m_panelName[2], null },
                { m_panelName[3], null },
                { m_panelName[4], GameEvents.RedPointEvents.Sys_OnNewAchievementReadedEvent },
                { m_panelName[5], null },
                { m_panelName[6], null },
            };
#endif

            this.m_panelDown = this.Transform.Find("Panel_down");

            m_push_gift_btn           = this.Make <GameButton>("ActivityAnimator:Button_activitiesgift");
            m_push_gift_count_root    = m_push_gift_btn.Make <GameLabel>("ImgWarn");
            m_push_gift_count_txt     = m_push_gift_btn.Make <GameLabel>("ImgWarn:Text");
            m_push_gift_left_time_txt = m_push_gift_btn.Make <GameLabel>("time");
            m_push_gift_view          = this.Make <GiftView>("Panel_activitiesgift");

            m_push_gift_btn_effect = this.Make <GameUIEffect>("ActivityAnimator:Button_activitiesgift:UI_huodong_03");
            m_push_gift_btn_effect.EffectPrefabName = "UI_huodong_03.prefab";


            m_combine_tips = Make <CombineTipsView>("Image");
        }
Esempio n. 8
0
 private void SetBuyButton(bool enable)
 {
     BuyButton.Enabled = enable;
     BuyButton.GetComponent <UITexture>().mainTexture = Resources.Load <Texture2D>(enable ? "Images/UI/ButtonLong" : "Images/UI/ButtonLongInactive");
 }