示例#1
0
 public override void init()
 {
     this.honur = new a3_honor(this, base.transform.FindChild("contents/a3_honor"));
     this.rank  = new a3_rank(this, base.transform.FindChild("contents/a3_rank"));
     this.tc    = new TabControl();
     a3_achievement.instance = this;
     this.tc.onClickHanle    = delegate(TabControl t)
     {
         int         seletedIndex         = t.getSeletedIndex();
         int         num                  = 0;
         Transform   transform            = base.transform.FindChild("contents");
         Transform[] componentsInChildren = transform.GetComponentsInChildren <Transform>(true);
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             Transform transform2 = componentsInChildren[i];
             bool      flag       = transform2.parent == transform;
             if (flag)
             {
                 bool flag2 = num == seletedIndex;
                 if (flag2)
                 {
                     transform2.gameObject.SetActive(true);
                 }
                 else
                 {
                     transform2.gameObject.SetActive(false);
                 }
                 num++;
             }
         }
         bool flag3 = this.currentAchieve != null;
         if (flag3)
         {
             this.currentAchieve.onClosed();
         }
         int num2 = seletedIndex;
         if (num2 != 0)
         {
             if (num2 == 1)
             {
                 this.currentAchieve = this.rank;
             }
         }
         else
         {
             this.currentAchieve = this.honur;
         }
         bool flag4 = this.currentAchieve != null;
         if (flag4)
         {
             this.currentAchieve.onShowed();
         }
     };
     this.tc.create(base.transform.FindChild("tabs").gameObject, base.gameObject, 0, 0, false);
 }
        public override void init()
        {
            // honur = new a3_honor(this, transform.FindChild("contents/a3_honor"));
            // rank = new a3_rank(this, transform.FindChild("contents/a3_rank"));

            tc              = new TabControl();
            instance        = this;
            tc.onClickHanle = (TabControl t) =>
            {
                int       i       = t.getSeletedIndex();
                int       n       = 0;
                Transform content = transform.FindChild("contents");
                foreach (var v in content.GetComponentsInChildren <Transform>(true))
                {
                    if (v.parent == content)
                    {
                        if (n == i)
                        {
                            v.gameObject.SetActive(true);
                        }
                        else
                        {
                            v.gameObject.SetActive(false);
                        }
                        n++;
                    }
                }
                if (currentAchieve != null)
                {
                    currentAchieve.onClosed();
                }
                switch (i)
                {
                case 0:
                    currentAchieve = honur;
                    break;

                case 1:
                    currentAchieve = rank;
                    break;
                }
                if (currentAchieve != null)
                {
                    currentAchieve.onShowed();
                }
            };
            tc.create(transform.FindChild("tabs").gameObject, this.gameObject);
        }