Пример #1
0
 public void Deserialize(Json_Support json)
 {
     this.FUID        = json.fuid;
     this.PlayerName  = json.name;
     this.PlayerLevel = json.lv;
     this.Cost        = json.cost;
     if (json.unit != null)
     {
         Json_Unit unit = json.unit;
         this.UnitID     = unit.iname;
         this.UnitLevel  = unit.lv;
         this.UnitRarity = unit.rare;
         if (unit.select != null)
         {
             this.JobID = (string)null;
             for (int index = 0; index < unit.jobs.Length; ++index)
             {
                 if (unit.jobs[index].iid == unit.select.job)
                 {
                     this.JobID = unit.jobs[index].iname;
                     break;
                 }
             }
         }
         this.LeaderSkillLevel = UnitParam.GetLeaderSkillLevel(this.UnitRarity, unit.plus);
         UnitData unitData = new UnitData();
         unitData.Deserialize(unit);
         this.Unit = unitData;
     }
     this.mIsFriend = json.isFriend;
 }
Пример #2
0
 private void GenerateList(int page = 0)
 {
     this.mUnitList.ForEach((Action <GameObject>)(go => UnityEngine.Object.Destroy((UnityEngine.Object)go)));
     this.mUnitList.Clear();
     for (int index1 = 0; index1 < 28; ++index1)
     {
         UnitData data   = (UnitData)null;
         int      index2 = index1 + page * 28;
         if (index2 < this.mDraftUnitListCache.Count)
         {
             Json_Unit jsonUnit = this.mDraftUnitListCache[index2].GetJson_Unit();
             if (jsonUnit != null)
             {
                 data = new UnitData();
                 data.Deserialize(jsonUnit);
             }
         }
         GameObject root = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.mGOUnitItem);
         DataSource.Bind <UnitData>(root, data);
         GameParameter.UpdateAll(root);
         root.get_transform().SetParent(this.mUnitParentTransform, false);
         root.SetActive(true);
         this.mUnitList.Add(root);
     }
     this.mPageNowTxt.set_text((this.mPage + 1).ToString());
     if (this.mPage - 1 < 0)
     {
         FlowNode_GameObject.ActivateOutputLinks((Component)this, 21);
     }
     if (this.mPage + 1 < this.mPageMax)
     {
         return;
     }
     FlowNode_GameObject.ActivateOutputLinks((Component)this, 22);
 }
Пример #3
0
        public static void CreateDummyData(Json_Unit[] units)
        {
            if (units == null)
            {
                return;
            }
            for (int index1 = 0; index1 < units.Length; ++index1)
            {
                Json_Unit     unit = units[index1];
                TobiraParam[] tobiraListForUnit = MonoSingleton <GameManager> .Instance.MasterParam.GetTobiraListForUnit(unit.iname);

                List <Json_Tobira> jsonTobiraList = new List <Json_Tobira>();
                for (int index2 = 0; index2 < tobiraListForUnit.Length; ++index2)
                {
                    TobiraParam tobiraParam = tobiraListForUnit[index2];
                    if (tobiraParam != null)
                    {
                        jsonTobiraList.Add(new Json_Tobira()
                        {
                            category = (int)tobiraParam.TobiraCategory,
                            lv       = index2 % 5 + 1
                        });
                    }
                }
                if (jsonTobiraList.Count > 0)
                {
                    unit.doors = jsonTobiraList.ToArray();
                }
            }
        }
Пример #4
0
        public void Init(string unitId, bool isConver)
        {
            if (string.IsNullOrEmpty(unitId) || Object.op_Equality((Object)this.PopupUnit, (Object)null))
            {
                return;
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;

            this.mUnitData = instance.Player.Units.Find((Predicate <UnitData>)(u => u.UnitID == unitId));
            if (this.mUnitData == null)
            {
                Json_Unit json = new Json_Unit();
                json.iid       = -1L;
                json.iname     = unitId;
                this.mUnitData = new UnitData();
                this.mUnitData.Deserialize(json);
            }
            DataSource.Bind <UnitData>(((Component)this).get_gameObject(), this.mUnitData);
            DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), instance.MasterParam.GetItemParam((string)this.mUnitData.UnitParam.piece));
            GameParameter.UpdateAll(((Component)this).get_gameObject());
            bool flag = isConver;

            this.mIsShardEnd = !flag;
            if (flag && Object.op_Inequality((Object)this.ShardNum, (Object)null))
            {
                Text component = (Text)this.ShardNum.GetComponent <Text>();
                if (Object.op_Inequality((Object)component, (Object)null))
                {
                    component.set_text(this.mUnitData.GetChangePieces().ToString());
                }
            }
            if (!Object.op_Inequality((Object)this.ShardGauge, (Object)null))
            {
                return;
            }
            this.ShardGauge.SetActive(flag);
            if (!flag)
            {
                return;
            }
            int awakeLv = this.mUnitData.AwakeLv;

            if (awakeLv < this.mUnitData.GetAwakeLevelCap())
            {
                ItemParam itemParam = MonoSingleton <GameManager> .Instance.MasterParam.GetItemParam((string)this.mUnitData.UnitParam.piece);

                this.mShardWindow = (GetUnitShard)this.ShardGauge.GetComponent <GetUnitShard>();
                this.mShardWindow.Refresh(this.mUnitData.UnitParam, itemParam.name, awakeLv, this.mUnitData.GetChangePieces(), 0);
            }
            else
            {
                this.ShardGauge.get_gameObject().SetActive(false);
                this.mIsShardEnd = true;
            }
        }
Пример #5
0
 private void Initialize()
 {
     this.mSingleMode          = false;
     this.mVersusDraftUnitList = new List <VersusDraftUnit>();
     for (int index1 = 0; index1 < VersusDraftList.VersusDraftUnitList.Count && (this.mDraftUnitTransforms != null && this.mDraftUnitTransforms.Length > 0); ++index1)
     {
         Json_Unit jsonUnit = VersusDraftList.VersusDraftUnitList[index1].GetJson_Unit();
         if (jsonUnit != null)
         {
             UnitData unit = new UnitData();
             unit.Deserialize(jsonUnit);
             if (unit != null)
             {
                 VersusDraftUnit versusDraftUnit = (VersusDraftUnit)UnityEngine.Object.Instantiate <VersusDraftUnit>((M0)this.mDraftUnitItem);
                 this.mVersusDraftUnitList.Add(versusDraftUnit);
                 Transform draftUnitTransform = this.mDraftUnitTransforms[0];
                 int       index2             = 0;
                 for (int index3 = 0; index3 < this.DRAFT_UNIT_LIST_COLS.Length; ++index3)
                 {
                     if (index1 < this.DRAFT_UNIT_LIST_COLS[index3])
                     {
                         index2 = index3;
                         break;
                     }
                 }
                 if (this.mDraftUnitTransforms.Length > index2)
                 {
                     draftUnitTransform = this.mDraftUnitTransforms[index2];
                 }
                 versusDraftUnit.SetUp(unit, draftUnitTransform, VersusDraftList.VersusDraftUnitList[index1].IsHidden);
             }
         }
     }
     this.mVersusDraftSelectedUnit = new List <VersusDraftSelectedUnit>();
     for (int index = 0; index < 6 && !UnityEngine.Object.op_Equality((UnityEngine.Object) this.mSelectedUnitTransform, (UnityEngine.Object)null); ++index)
     {
         VersusDraftSelectedUnit draftSelectedUnit = (VersusDraftSelectedUnit)UnityEngine.Object.Instantiate <VersusDraftSelectedUnit>((M0)this.mSelectedUnitItem);
         this.mVersusDraftSelectedUnit.Add(draftSelectedUnit);
         ((Component)draftSelectedUnit).get_transform().SetParent(this.mSelectedUnitTransform, false);
         ((Component)draftSelectedUnit).get_gameObject().SetActive(true);
         draftSelectedUnit.Initialize();
     }
     this.mRandomSelecting = false;
     VersusDraftList.VersusDraftUnitDataListPlayer = new List <UnitData>();
     VersusDraftList.VersusDraftUnitDataListEnemy  = new List <UnitData>();
     FlowNode_GameObject.ActivateOutputLinks((Component)this, 101);
 }
Пример #6
0
        private UnitData CreateUnitData(UnitParam uparam)
        {
            UnitData  unitData = new UnitData();
            Json_Unit json     = new Json_Unit()
            {
                iid    = 1,
                iname  = uparam.iname,
                exp    = 0,
                lv     = 1,
                plus   = 0,
                rare   = 0,
                select = new Json_UnitSelectable(),
                jobs   = (Json_Job[])null,
                abil   = (Json_MasterAbility)null
            };

            json.abil = (Json_MasterAbility)null;
            if (uparam.jobsets != null && uparam.jobsets.Length > 0)
            {
                List <Json_Job> jsonJobList = new List <Json_Job>(uparam.jobsets.Length);
                int             num         = 1;
                for (int index = 0; index < uparam.jobsets.Length; ++index)
                {
                    JobSetParam jobSetParam = MonoSingleton <GameManager> .Instance.GetJobSetParam(uparam.jobsets[index]);

                    if (jobSetParam != null)
                    {
                        jsonJobList.Add(new Json_Job()
                        {
                            iid    = (long)num++,
                            iname  = jobSetParam.job,
                            rank   = 0,
                            equips = (Json_Equip[])null,
                            abils  = (Json_Ability[])null
                        });
                    }
                }
                json.jobs = jsonJobList.ToArray();
            }
            unitData.Deserialize(json);
            unitData.SetUniqueID(1L);
            unitData.JobRankUp(0);
            return(unitData);
        }
 public override void Complete(WWWResult www)
 {
     if (Network.IsError)
     {
         this.m_Node.OnBack();
     }
     else
     {
         DebugMenu.Log("API", this.url + ":" + www.text);
         WebAPI.JSON_BodyResponse <FlowNode_ReqFriendSupport.Api_FriendSupport.Json> jsonBodyResponse = (WebAPI.JSON_BodyResponse <FlowNode_ReqFriendSupport.Api_FriendSupport.Json>)JsonUtility.FromJson <WebAPI.JSON_BodyResponse <FlowNode_ReqFriendSupport.Api_FriendSupport.Json> >(www.text);
         DebugUtility.Assert(jsonBodyResponse != null, "res == null");
         if (jsonBodyResponse.body != null && jsonBodyResponse.body.unit != null)
         {
             UnitData[] unitDataArray = new UnitData[Enum.GetValues(typeof(EElement)).Length];
             if (jsonBodyResponse.body.units != null)
             {
                 for (int index = 0; index < jsonBodyResponse.body.units.Length; ++index)
                 {
                     Json_Unit unit = jsonBodyResponse.body.units[index];
                     int       elem = unit.elem;
                     if (elem >= unitDataArray.Length || elem < 0)
                     {
                         DebugUtility.LogError(string.Format("不正なインデックスが属性値として指定されています。 elem = {0}", (object)elem));
                     }
                     else
                     {
                         unitDataArray[elem] = new UnitData();
                         unitDataArray[elem].Deserialize(unit);
                     }
                 }
             }
             if (jsonBodyResponse.body.unit != null)
             {
                 UnitData unitData = new UnitData();
                 unitData.Deserialize(jsonBodyResponse.body.unit);
                 unitDataArray[0] = unitData;
             }
             this.m_ValueList.SetObject("data_units", (object)unitDataArray);
         }
         Network.RemoveAPI();
         this.Success();
     }
 }
Пример #8
0
        public static UnitData CreateUnitData(UnitParam param)
        {
            UnitData  unitData = new UnitData();
            Json_Unit json     = new Json_Unit();

            json.iid        = 1L;
            json.iname      = param.iname;
            json.exp        = 0;
            json.lv         = 1;
            json.plus       = 0;
            json.rare       = (int)param.rare;
            json.select     = new Json_UnitSelectable();
            json.select.job = 0L;
            json.jobs       = (Json_Job[])null;
            json.abil       = (Json_MasterAbility)null;
            if (param.jobsets != null && param.jobsets.Length > 0)
            {
                List <Json_Job> jsonJobList = new List <Json_Job>(param.jobsets.Length);
                int             num         = 1;
                for (int index = 0; index < param.jobsets.Length; ++index)
                {
                    JobSetParam jobSetParam = MonoSingleton <GameManager> .GetInstanceDirect().GetJobSetParam((string)param.jobsets[index]);

                    if (jobSetParam != null)
                    {
                        jsonJobList.Add(new Json_Job()
                        {
                            iid    = (long)num++,
                            iname  = jobSetParam.job,
                            rank   = 0,
                            equips = (Json_Equip[])null,
                            abils  = (Json_Ability[])null
                        });
                    }
                }
                json.jobs = jsonJobList.ToArray();
            }
            unitData.Deserialize(json);
            unitData.SetUniqueID(1L);
            unitData.JobRankUp(0);
            return(unitData);
        }
Пример #9
0
        public Json_Unit GetJson_Unit()
        {
            GameManager instance = MonoSingleton <GameManager> .Instance;

            if (Object.op_Equality((Object)instance, (Object)null))
            {
                return((Json_Unit)null);
            }
            if (instance.GetUnitParam(this.mUnitIName) == null)
            {
                return((Json_Unit)null);
            }
            Json_Unit jsonUnit = new Json_Unit();

            jsonUnit.iid    = this.mDraftUnitId;
            jsonUnit.iname  = this.mUnitIName;
            jsonUnit.rare   = this.mRare;
            jsonUnit.plus   = this.mAwake;
            jsonUnit.exp    = instance.MasterParam.GetUnitLevelExp(this.mLevel);
            jsonUnit.lv     = this.mLevel;
            jsonUnit.fav    = 0;
            jsonUnit.elem   = 0;
            jsonUnit.select = new Json_UnitSelectable();
            jsonUnit.jobs   = new Json_Job[this.mVersusDraftUnitJobs.Count];
            for (int index1 = 0; index1 < this.mVersusDraftUnitJobs.Count; ++index1)
            {
                JobParam jobParam = instance.GetJobParam(this.mVersusDraftUnitJobs[index1].mIName);
                if (jobParam != null && jobParam.ranks.Length > this.mVersusDraftUnitJobs[index1].mRank)
                {
                    JobRankParam rank    = jobParam.ranks[this.mVersusDraftUnitJobs[index1].mRank];
                    Json_Job     jsonJob = new Json_Job();
                    jsonJob.iid    = this.mDummyIID * 10L + (long)index1;
                    jsonJob.iname  = this.mVersusDraftUnitJobs[index1].mIName;
                    jsonJob.rank   = this.mVersusDraftUnitJobs[index1].mRank;
                    jsonJob.equips = new Json_Equip[JobRankParam.MAX_RANKUP_EQUIPS];
                    if (this.mVersusDraftUnitJobs[index1].mEquip)
                    {
                        for (int index2 = 0; index2 < JobRankParam.MAX_RANKUP_EQUIPS; ++index2)
                        {
                            jsonJob.equips[index2] = new Json_Equip()
                            {
                                iid   = jsonJob.iid * 10L + (long)index2,
                                iname = rank.equips[index2]
                            }
                        }
                        ;
                    }
                    jsonJob.select           = new Json_JobSelectable();
                    jsonJob.select.abils     = new long[5];
                    jsonJob.select.artifacts = new long[3];
                    List <Json_Ability> jsonAbilityList = new List <Json_Ability>();
                    List <string>       stringList      = new List <string>();
                    stringList.Add(jobParam.fixed_ability);
                    for (int index2 = 1; index2 <= jsonJob.rank; ++index2)
                    {
                        if (jobParam.ranks.Length >= index2 && jobParam.ranks[index2] != null && jobParam.ranks[index2].learnings != null)
                        {
                            for (int index3 = 0; index3 < jobParam.ranks[index2].learnings.Length; ++index3)
                            {
                                stringList.Add((string)jobParam.ranks[index2].learnings[index3]);
                            }
                        }
                    }
                    for (int index2 = 0; index2 < stringList.Count; ++index2)
                    {
                        Json_Ability jsonAbility = new Json_Ability();
                        jsonAbility.iid   = jsonJob.iid * 10L + (long)index2;
                        jsonAbility.iname = stringList[index2];
                        jsonAbility.exp   = 0;
                        jsonAbilityList.Add(jsonAbility);
                        if (this.mAbilities.ContainsKey(jsonAbility.iname))
                        {
                            jsonAbility.exp = this.mAbilities[jsonAbility.iname].mLevel - 1;
                            jsonAbility.iid = this.mAbilities[jsonAbility.iname].mIID;
                        }
                    }
                    jsonJob.abils = jsonAbilityList.ToArray();
                    if (index1 == this.mSelectJobIndex)
                    {
                        jsonUnit.select.job = jsonJob.iid;
                        jsonJob.artis       = new Json_Artifact[3];
                        for (int index2 = 0; index2 < this.mVersusDraftUnitArtifacts.Count; ++index2)
                        {
                            Json_Artifact jsonArtifact = new Json_Artifact();
                            jsonArtifact.iid                 = jsonJob.iid * 100L + (long)index2;
                            jsonArtifact.iname               = this.mVersusDraftUnitArtifacts[index2].mIName;
                            jsonArtifact.rare                = this.mVersusDraftUnitArtifacts[index2].mRare;
                            jsonArtifact.exp                 = ArtifactData.StaticCalcExpFromLevel(this.mVersusDraftUnitArtifacts[index2].mLevel);
                            jsonJob.artis[index2]            = jsonArtifact;
                            jsonJob.select.artifacts[index2] = jsonArtifact.iid;
                        }
                        int index3 = 0;
                        using (Dictionary <string, VersusDraftUnitAbility> .ValueCollection.Enumerator enumerator = this.mAbilities.Values.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                VersusDraftUnitAbility current = enumerator.Current;
                                jsonJob.select.abils[index3] = current.mIID;
                                ++index3;
                            }
                        }
                        jsonJob.cur_skin = this.mSkinIName;
                    }
                    jsonUnit.jobs[index1] = jsonJob;
                }
            }
            if (!string.IsNullOrEmpty(this.mMasterAbilityIName))
            {
                jsonUnit.abil       = new Json_MasterAbility();
                jsonUnit.abil.iid   = this.mDummyIID;
                jsonUnit.abil.iname = this.mMasterAbilityIName;
                jsonUnit.abil.exp   = 0;
            }
            ConceptCardParam conceptCardParam = instance.MasterParam.GetConceptCardParam(this.mConceptCardIName);

            if (conceptCardParam != null)
            {
                RarityParam rarityParam = instance.GetRarityParam(conceptCardParam.rare);
                jsonUnit.concept_card             = new JSON_ConceptCard();
                jsonUnit.concept_card.iname       = this.mConceptCardIName;
                jsonUnit.concept_card.iid         = this.mDummyIID;
                jsonUnit.concept_card.plus        = (int)rarityParam.ConceptCardAwakeCountMax;
                jsonUnit.concept_card.exp         = instance.MasterParam.GetConceptCardLevelExp(conceptCardParam.rare, this.mConceptCardLevel);
                jsonUnit.concept_card.trust       = 0;
                jsonUnit.concept_card.trust_bonus = 0;
                jsonUnit.concept_card.fav         = 0;
            }
            jsonUnit.doors = new Json_Tobira[this.mVersusDraftUnitDoors.Count];
            List <Json_Ability> jsonAbilityList1 = new List <Json_Ability>();

            for (int index1 = 0; index1 < this.mVersusDraftUnitDoors.Count; ++index1)
            {
                Json_Tobira jsonTobira = new Json_Tobira();
                jsonTobira.category    = (int)this.mVersusDraftUnitDoors[index1].mCategory;
                jsonTobira.lv          = this.mVersusDraftUnitDoors[index1].mLevel;
                jsonUnit.doors[index1] = jsonTobira;
                TobiraParam tobiraParam = instance.MasterParam.GetTobiraParam(this.mUnitIName, this.mVersusDraftUnitDoors[index1].mCategory);
                if (tobiraParam != null)
                {
                    for (int index2 = 0; index2 < tobiraParam.LeanAbilityParam.Length; ++index2)
                    {
                        TobiraLearnAbilityParam learnAbilityParam = tobiraParam.LeanAbilityParam[index2];
                        if (learnAbilityParam.Level <= jsonTobira.lv)
                        {
                            switch (learnAbilityParam.AbilityAddType)
                            {
                            case TobiraLearnAbilityParam.AddType.JobOverwrite:
                                for (int index3 = 0; index3 < jsonUnit.jobs.Length; ++index3)
                                {
                                    for (int index4 = 0; index4 < jsonUnit.jobs[index3].abils.Length; ++index4)
                                    {
                                        if (jsonUnit.jobs[index3].abils[index4].iname == learnAbilityParam.AbilityOverwrite)
                                        {
                                            jsonUnit.jobs[index3].abils[index4].iname = learnAbilityParam.AbilityIname;
                                            if (this.mAbilities.ContainsKey(learnAbilityParam.AbilityIname))
                                            {
                                                jsonUnit.jobs[index3].abils[index4].iid = this.mAbilities[learnAbilityParam.AbilityIname].mIID;
                                                jsonUnit.jobs[index3].abils[index4].exp = this.mAbilities[learnAbilityParam.AbilityIname].mLevel - 1;
                                            }
                                        }
                                    }
                                }
                                continue;

                            case TobiraLearnAbilityParam.AddType.MasterAdd:
                                jsonAbilityList1.Add(new Json_Ability()
                                {
                                    iid   = this.mDummyIID * 100L + (long)(index1 * 10) + (long)index2,
                                    iname = learnAbilityParam.AbilityIname,
                                    exp   = 0
                                });
                                continue;

                            default:
                                continue;
                            }
                        }
                    }
                }
            }
            jsonUnit.door_abils = jsonAbilityList1.ToArray();
            return(jsonUnit);
        }
    }
Пример #10
0
        public void Refresh()
        {
            JSON_MyPhotonRoomParam   myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.SearchRoom(JSON_MyPhotonRoomParam.Parse(MonoSingleton <GameManager> .Instance.AudienceRoom.json).roomid).json);
            JSON_MyPhotonPlayerParam dataOfClass       = DataSource.FindDataOfClass <JSON_MyPhotonPlayerParam>(((Component)this).get_gameObject(), (JSON_MyPhotonPlayerParam)null);

            if (dataOfClass != null)
            {
                if (Object.op_Inequality((Object)this.EmptyObj, (Object)null))
                {
                    this.EmptyObj.SetActive(false);
                }
                if (Object.op_Inequality((Object)this.ValidObj, (Object)null))
                {
                    this.ValidObj.SetActive(true);
                }
                if (Object.op_Inequality((Object)this.LeaderUnit, (Object)null))
                {
                    if (myPhotonRoomParam.draft_type == 1 && !string.IsNullOrEmpty(dataOfClass.support_unit))
                    {
                        Json_Unit jsonObject = JSONParser.parseJSONObject <Json_Unit>(dataOfClass.support_unit);
                        if (jsonObject != null)
                        {
                            UnitData data = new UnitData();
                            data.Deserialize(jsonObject);
                            DataSource.Bind <UnitData>(this.LeaderUnit.get_gameObject(), data);
                        }
                    }
                    else if (dataOfClass.units != null)
                    {
                        dataOfClass.SetupUnits();
                        DataSource.Bind <UnitData>(this.LeaderUnit, dataOfClass.units[0].unit);
                    }
                }
                if (Object.op_Inequality((Object)this.Name, (Object)null))
                {
                    this.Name.set_text(dataOfClass.playerName);
                }
                if (Object.op_Inequality((Object)this.Lv, (Object)null))
                {
                    this.Lv.set_text(dataOfClass.playerLevel.ToString());
                }
                if (Object.op_Inequality((Object)this.Total, (Object)null))
                {
                    this.Total.set_text(dataOfClass.totalAtk.ToString());
                }
                if (Object.op_Inequality((Object)this.ReadyObj, (Object)null))
                {
                    this.ReadyObj.SetActive(dataOfClass.state != 4);
                }
                if (Object.op_Inequality((Object)this.Award, (Object)null))
                {
                    this.Award.get_gameObject().SetActive(false);
                    this.Award.get_gameObject().SetActive(true);
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
            }
            else
            {
                if (Object.op_Inequality((Object)this.EmptyObj, (Object)null))
                {
                    this.EmptyObj.SetActive(true);
                }
                if (Object.op_Inequality((Object)this.ValidObj, (Object)null))
                {
                    this.ValidObj.SetActive(false);
                }
                if (!Object.op_Inequality((Object)this.ReadyObj, (Object)null))
                {
                    return;
                }
                this.ReadyObj.SetActive(false);
            }
        }
Пример #11
0
        private void RefreshItems()
        {
            Transform transform = ((Component)this).get_transform();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            MyPhoton.MyRoom          currentRoom = instance.GetCurrentRoom();
            JSON_MyPhotonRoomParam   data1       = JSON_MyPhotonRoomParam.Parse(currentRoom.json);
            JSON_MyPhotonPlayerParam owner       = data1?.GetOwner();
            int num1 = owner != null ? owner.playerIndex : 0;
            List <MyPhoton.MyPlayer> roomPlayerList1 = instance.GetRoomPlayerList();

            for (int count = this.UIItemList.Count; count < currentRoom.maxPlayers; ++count)
            {
                this.UIItemList.Add((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate));
                if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER)
                {
                    this.PlayerInfo.SetActive(false);
                    this.PlayerInfoList.Add((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.PlayerInfo));
                }
            }
            int maxPlayers = currentRoom.maxPlayers;

            if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.VERSUS)
            {
                --maxPlayers;
            }
            for (int index1 = 0; index1 < maxPlayers; ++index1)
            {
                JSON_MyPhotonPlayerParam data2 = (JSON_MyPhotonPlayerParam)null;
                int num2 = index1 + 1;
                if (num1 > 0)
                {
                    if (index1 == 0)
                    {
                        num2 = num1;
                    }
                    else if (index1 < num1)
                    {
                        num2 = index1;
                    }
                }
                using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList1.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MyPhoton.MyPlayer current = enumerator.Current;
                        if (current.json != null)
                        {
                            JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(current.json);
                            if (photonPlayerParam != null && photonPlayerParam.playerIndex == num2)
                            {
                                data2 = photonPlayerParam;
                                break;
                            }
                        }
                    }
                }
                if (data2 == null)
                {
                    data2             = new JSON_MyPhotonPlayerParam();
                    data2.playerIndex = num2;
                }
                GameObject uiItem = this.UIItemList[index1];
                ((UnityEngine.Object)uiItem).set_hideFlags((HideFlags)52);
                DataSource.Bind <JSON_MyPhotonPlayerParam>(uiItem, data2);
                DataSource.Bind <JSON_MyPhotonRoomParam>(uiItem, data1);
                if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER)
                {
                    DataSource.Bind <JSON_MyPhotonPlayerParam>(this.PlayerInfoList[index1], data2);
                    DataSource.Bind <JSON_MyPhotonRoomParam>(this.PlayerInfoList[index1], data1);
                    this.PlayerInfoList[index1].get_transform().SetParent(this.PlayerInfo.get_transform().get_parent(), false);
                    this.PlayerInfoList[index1].get_gameObject().SetActive(true);
                }
                GameObjectID[] componentsInChildren = (GameObjectID[])uiItem.GetComponentsInChildren <GameObjectID>(true);
                if (data2 != null && componentsInChildren != null)
                {
                    for (int index2 = 0; index2 < componentsInChildren.Length; ++index2)
                    {
                        GameObjectID gameObjectId = componentsInChildren[index2];
                        if (gameObjectId.ID != null)
                        {
                            DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), (UnitData)null);
                        }
                    }
                    if (data1.draft_type == 1 && !string.IsNullOrEmpty(data2.support_unit))
                    {
                        GameObjectID gameObjectId = Array.Find <GameObjectID>(componentsInChildren, (Predicate <GameObjectID>)(goID => goID.ID.Equals("unit0")));
                        Json_Unit    jsonObject   = JSONParser.parseJSONObject <Json_Unit>(data2.support_unit);
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObjectId, (UnityEngine.Object)null) && jsonObject != null)
                        {
                            UnitData data3 = new UnitData();
                            data3.Deserialize(jsonObject);
                            DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), data3);
                        }
                    }
                    else if (data2.units != null)
                    {
                        for (int index2 = 0; index2 < data2.units.Length; ++index2)
                        {
                            int      slotId = data2.units[index2].slotID;
                            bool     flag1  = data2.units[index2].sub == 1;
                            UnitData data3  = data2.units[index2].unit;
                            if (data3 != null)
                            {
                                if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER)
                                {
                                    for (int index3 = 0; index3 < componentsInChildren.Length; ++index3)
                                    {
                                        GameObjectID gameObjectId = componentsInChildren[index3];
                                        if (gameObjectId.ID != null && (gameObjectId.ID.Equals("unit" + (object)slotId) || flag1) && (!flag1 || index3 == componentsInChildren.Length - 1))
                                        {
                                            data3.TempFlags |= UnitData.TemporaryFlags.AllowJobChange;
                                            DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), data3);
                                            UnitIcon component = (UnitIcon)((Component)gameObjectId).get_gameObject().GetComponent <UnitIcon>();
                                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null) && data2.playerIndex > 0)
                                            {
                                                DataSource.Bind <PlayerPartyTypes>(((Component)gameObjectId).get_gameObject(), PlayerPartyTypes.MultiTower);
                                                bool flag2 = data2.playerIndex == PunMonoSingleton <MyPhoton> .Instance.MyPlayerIndex;
                                                component.AllowJobChange = flag2;
                                                if (flag2)
                                                {
                                                    UnitData unitDataByUnitId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUnitID(data3.UnitParam.iname);

                                                    if (unitDataByUnitId != null)
                                                    {
                                                        unitDataByUnitId.TempFlags |= UnitData.TemporaryFlags.AllowJobChange;
                                                        DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), unitDataByUnitId);
                                                        data3 = unitDataByUnitId;
                                                    }
                                                }
                                            }
                                            if (index3 == 0 && this.PlayerInfoList.Count > index1)
                                            {
                                                DataSource.Bind <UnitData>(this.PlayerInfoList[index1], data3);
                                                break;
                                            }
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    for (int index3 = 0; index3 < componentsInChildren.Length; ++index3)
                                    {
                                        GameObjectID gameObjectId = componentsInChildren[index3];
                                        if (gameObjectId.ID != null && gameObjectId.ID.Equals("unit" + (object)slotId))
                                        {
                                            DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), data3);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                ListItemEvents component1 = (ListItemEvents)uiItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect      = new ListItemEvents.ListItemEvent(this.OnSelectItem);
                    component1.OnOpenDetail  = new ListItemEvents.ListItemEvent(this.OnOpenItemDetail);
                    component1.OnCloseDetail = new ListItemEvents.ListItemEvent(this.OnCloseItemDetail);
                }
                uiItem.get_transform().SetParent(transform, false);
                uiItem.get_gameObject().SetActive(true);
            }
            QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data1.iname);

            DataSource.Bind <QuestParam>(this.Root, quest);
            bool flag = false;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SkillObj, (UnityEngine.Object)null) && quest != null)
            {
                if (quest.IsMultiLeaderSkill)
                {
                    List <MyPhoton.MyPlayer> roomPlayerList2 = instance.GetRoomPlayerList();
                    if (roomPlayerList2 != null)
                    {
                        MyPhoton.MyPlayer myPlayer = roomPlayerList2.Find((Predicate <MyPhoton.MyPlayer>)(member => member.playerID == 1));
                        if (myPlayer != null)
                        {
                            JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                            if (photonPlayerParam != null && photonPlayerParam.units != null && photonPlayerParam.units.Length > 0)
                            {
                                UnitData data2 = new UnitData();
                                if (data2 != null)
                                {
                                    data2.Deserialize(photonPlayerParam.units[0].unitJson);
                                    DataSource.Bind <UnitData>(this.SkillObj, data2);
                                    flag = data2.LeaderSkill != null;
                                }
                            }
                        }
                    }
                }
                SRPG_Button component = (SRPG_Button)this.SkillObj.GetComponent <SRPG_Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                {
                    ((Selectable)component).set_interactable(quest.IsMultiLeaderSkill && flag);
                }
            }
            GameParameter.UpdateAll(this.Root);
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1);
        }