コード例 #1
0
ファイル: GUIMysteryScene.cs プロジェクト: floatyears/Decrypt
 private void CreateObjects()
 {
     GameObject gameObject = GameUITools.FindGameObject("Panel", base.gameObject);
     this.mPanel = gameObject.GetComponent<UIPanel>();
     MysteryBtn mysteryBtn = GameUITools.FindGameObject("PVP", gameObject).AddComponent<MysteryBtn>();
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_35 = mysteryBtn;
     expr_35.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_35.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnPVPClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(6), true);
     if (mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryPVP"));
     }
     else
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(6)
         }));
     }
     mysteryBtn = GameUITools.FindGameObject("Pillage", gameObject).AddComponent<MysteryBtn>();
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_DC = mysteryBtn;
     expr_DC.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_DC.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnPillageClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(8), true);
     if (mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(GUIMysteryScene.PillageRed());
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryPillage"));
     }
     else
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(8)
         }));
     }
     mysteryBtn = GameUITools.FindGameObject("WorldBoss", gameObject).AddComponent<MysteryBtn>();
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_187 = mysteryBtn;
     expr_187.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_187.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnWorldBossClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(1), true);
     if (mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(GUIMysteryScene.WorldBossRed());
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryWorldBoss"));
     }
     else
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(1)
         }));
     }
     mysteryBtn = GameUITools.FindGameObject("KingReward", gameObject).AddComponent<MysteryBtn>();
     this.mKRBtn = mysteryBtn;
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_239 = mysteryBtn;
     expr_239.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_239.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnKingRewardClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(2), true);
     if (mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(GUIMysteryScene.KingRewardRed());
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryKingReward"));
     }
     else
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(2)
         }));
     }
     mysteryBtn = GameUITools.FindGameObject("Trial", gameObject).AddComponent<MysteryBtn>();
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_2E4 = mysteryBtn;
     expr_2E4.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_2E4.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnTrialClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(5), true);
     if (!mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(5)
         }));
     }
     else
     {
         mysteryBtn.SetRed(GUIMysteryScene.TrialRed());
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryTrial"));
     }
     mysteryBtn = GameUITools.FindGameObject("CostumeParty", gameObject).AddComponent<MysteryBtn>();
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_38F = mysteryBtn;
     expr_38F.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_38F.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnCostumepartyClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(10), true);
     if (mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(GUIMysteryScene.CostumePartyRed());
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryCostumeParty"));
     }
     else
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(10)
         }));
     }
     mysteryBtn = GameUITools.FindGameObject("AwakeRoad", gameObject).AddComponent<MysteryBtn>();
     this.mAwakeBtn = mysteryBtn;
     if ((ulong)Globals.Instance.Player.Data.Level < (ulong)((long)GameConst.GetInt32(26)))
     {
         mysteryBtn.gameObject.SetActive(false);
     }
     else
     {
         mysteryBtn.InitWithBaseScene();
         MysteryBtn expr_476 = mysteryBtn;
         expr_476.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_476.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnAwakeRoadClick));
         mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(24), true);
         if (mysteryBtn.IsOpen)
         {
             mysteryBtn.SetRed(GUIMysteryScene.AwakeRoadRed());
             mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryAwakeRoad"));
         }
         else
         {
             mysteryBtn.SetRed(false);
             mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
             {
                 GameConst.GetInt32(24)
             }));
         }
     }
     mysteryBtn = GameUITools.FindGameObject("Guard", gameObject).AddComponent<MysteryBtn>();
     mysteryBtn.InitWithBaseScene();
     MysteryBtn expr_523 = mysteryBtn;
     expr_523.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_523.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnGuardClick));
     mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(32), true);
     if (mysteryBtn.IsOpen)
     {
         mysteryBtn.SetRed(GUIMysteryScene.GuardRed());
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryGuard"));
     }
     else
     {
         mysteryBtn.SetRed(false);
         mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
         {
             GameConst.GetInt32(32)
         }));
     }
     mysteryBtn = GameUITools.FindGameObject("MagicLove", gameObject).AddComponent<MysteryBtn>();
     if (Tools.CanPlay(GameConst.GetInt32(245), true))
     {
         mysteryBtn.InitWithBaseScene();
         MysteryBtn expr_5E5 = mysteryBtn;
         expr_5E5.OnClickEvent = (MysteryBtn.VoidCallBack)Delegate.Combine(expr_5E5.OnClickEvent, new MysteryBtn.VoidCallBack(this.OnMagicLoveClick));
         mysteryBtn.IsOpen = Tools.CanPlay(GameConst.GetInt32(246), true);
         if (mysteryBtn.IsOpen)
         {
             mysteryBtn.SetRed(GUIMysteryScene.MagicLoveRed());
             mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryMagicLove"));
         }
         else
         {
             mysteryBtn.SetRed(false);
             mysteryBtn.SetTip(Singleton<StringManager>.Instance.GetString("mysteryOpenTip", new object[]
             {
                 GameConst.GetInt32(246)
             }));
         }
     }
     else
     {
         mysteryBtn.gameObject.SetActive(false);
     }
 }
コード例 #2
0
ファイル: GUIMysteryScene.cs プロジェクト: floatyears/Decrypt
 private void CenterOnItem(MysteryBtn btn)
 {
     Vector3[] worldCorners = this.mPanel.worldCorners;
     Vector3 position = (worldCorners[2] + worldCorners[0]) * 0.5f;
     Transform cachedTransform = this.mPanel.cachedTransform;
     UIScrollView component = this.mPanel.GetComponent<UIScrollView>();
     Vector3 a = cachedTransform.InverseTransformPoint(btn.transform.position);
     Vector3 b = cachedTransform.InverseTransformPoint(position);
     Vector3 b2 = a - b;
     if (!component.canMoveHorizontally)
     {
         b2.x = 0f;
     }
     if (!component.canMoveVertically)
     {
         b2.y = 0f;
     }
     b2.z = 0f;
     cachedTransform.localPosition -= b2;
     Vector4 v = this.mPanel.clipOffset;
     v.x += b2.x;
     v.y += b2.y;
     this.mPanel.clipOffset = v;
     component.RestrictWithinBounds(true);
 }