Esempio n. 1
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Map) {
           {
             QuestTmpls = new Dictionary<int, QuestTemplate>();
             TMap _map0 = iprot.ReadMapBegin();
             for( int _i1 = 0; _i1 < _map0.Count; ++_i1)
             {
               int _key2;
               QuestTemplate _val3;
               _key2 = iprot.ReadI32();
               _val3 = new QuestTemplate();
               _val3.Read(iprot);
               QuestTmpls[_key2] = _val3;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Map) {
           {
             QuestChapterTmpls = new Dictionary<int, QuestChapterTemplate>();
             TMap _map4 = iprot.ReadMapBegin();
             for( int _i5 = 0; _i5 < _map4.Count; ++_i5)
             {
               int _key6;
               QuestChapterTemplate _val7;
               _key6 = iprot.ReadI32();
               _val7 = new QuestChapterTemplate();
               _val7.Read(iprot);
               QuestChapterTmpls[_key6] = _val7;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
Esempio n. 2
0
    public override void OnEnter()
    {
        GlobalWindowSoundController.Instance.PlayOpenSound();
        if (TitleLabel == null)
        {
            TitleLabel = transform.FindChild("Label title").gameObject;
            BgTexture = transform.FindChild("Texture bg").gameObject;
            ItemContainer = transform.FindChild("Container items").gameObject;
            TotalRewardItem = transform.FindChild("Container total/SignItem").gameObject;
            ProgressLabel = transform.FindChild("Container total/Label progress").gameObject;
            TotalButton = transform.FindChild("Container total/Button").gameObject;
            BgUIEventListener = UIEventListener.Get(transform.FindChild("Container bg").gameObject);
            BgUIEventListener.onClick += ClickHandler;
            ButtonUIEventListener = UIEventListener.Get(TotalButton);
            ButtonUIEventListener.onClick += ClickBtnHandler;
            ItemPrefab = Resources.Load("Prefabs/Component/TaskItem") as GameObject;

            SignConfirm = transform.FindChild("Panel/SignConfirm").gameObject;
            SignCurrencyInfo = transform.FindChild("Panel/SignCurrencyInfo").gameObject;
            SignItemInfo = transform.FindChild("Panel/SignItemInfo").gameObject;

            Items = new List<GameObject>();
        }

        while (Items.Count < 9)
        {
            Items.Add(NGUITools.AddChild(ItemContainer, ItemPrefab));
            //var theitem = Items[Items.Count - 1].GetComponent<KxItemRender>();
        }

        chapterTemp = SystemModelLocator.Instance.QuestTemplates.QuestChapterTmpls[SystemModelLocator.Instance.QuestMsg.ChapterId];

        var lb = TitleLabel.GetComponent<UILabel>();
        lb.text = chapterTemp.Name;
        var signitem = TotalRewardItem.GetComponent<SignItemControl>();
        signitem.SetData(chapterTemp.RewardId, false, false, OnSelectTotalHandler);
        var tt = BgTexture.GetComponent<UITexture>();
        var k = (chapterTemp.Id % 3) + 1;
        tt.mainTexture = (Texture2D)Resources.Load("AssetBundles/Textures/Task/task" + k, typeof(Texture2D));

        int basex = -272;
        int basey = 155;
        int offsetx = 272;
        int offsety = -155;
        int yy = 0;
        int thecount = 0;
        for (int i = 0; i < SystemModelLocator.Instance.QuestMsg.QuestList.Count; i++)
        {
            int xx = i%3;
            var itemobj = Items[i];
            var item = itemobj.GetComponent<TaskItemControl>();
            itemobj.transform.localPosition = new Vector3(basex + xx * offsetx, basey + yy * offsety, 0);
            thecount += item.SetData(SystemModelLocator.Instance.QuestMsg.QuestList[i], OnSelectHandler);
            if (xx == 2)
            {
                yy++;
            }
        }

        lb = ProgressLabel.GetComponent<UILabel>();
        lb.text = "完成进度 " + thecount + "/9";

        TotalButton.SetActive(thecount == 9);
    }