Beispiel #1
0
 private void Update()
 {
     if (this.mButtonObj == null)
     {
         return;
     }
     for (int index = 0; index < this.mButtonObj.Count; ++index)
     {
         Unit dataOfClass = DataSource.FindDataOfClass <Unit>(this.mButtonObj[index], (Unit)null);
         if (dataOfClass != null)
         {
             Button component = (Button)this.mButtonObj[index].GetComponent <Button>();
             if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
             {
                 ((Selectable)component).set_interactable(!dataOfClass.IsDeadCondition());
             }
         }
     }
 }
        public ReqTowerBtlComEnd(long btlid, Unit[] Player, Unit[] Enemy, int actCount, int round, byte floor, BtlResultTypes result, RandDeckResult[] deck, Network.ResponseCallback response, string trophyprog = null, string bingoprog = null, int[] missions = null, int[] missions_value = null)
        {
            StringBuilder stringBuilder = WebAPI.GetStringBuilder();

            this.name            = "tower/btl/end";
            stringBuilder.Length = 0;
            this.SetValue(ref stringBuilder, "\"btlid\":", btlid);
            stringBuilder.Append("\"btlendparam\":{");
            if (Player != null)
            {
                stringBuilder.Append("\"pdeck\":[");
                for (int index = 0; index < Player.Length; ++index)
                {
                    Unit unit = Player[index];
                    if (unit.Side == EUnitSide.Player && unit.UnitData.UniqueID != 0L)
                    {
                        stringBuilder.Append("{");
                        this.SetValue(ref stringBuilder, "\"iid\":", unit.UnitData.UniqueID);
                        this.SetValue(ref stringBuilder, "\"iname\":\"", unit.UnitData.UnitParam.iname, "\",");
                        int num = Mathf.Max(unit.CalcTowerDamege() - MonoSingleton <GameManager> .Instance.FindTowerFloor(SceneBattle.Instance.Battle.QuestID).CalcHelaNum((int)unit.MaximumStatus.param.hp), 0);
                        this.SetValue(ref stringBuilder, "\"damage\":", (long)num);
                        this.SetValue(ref stringBuilder, "\"is_died\":", !unit.IsDeadCondition() ? 0L : (!unit.IsUnitFlag(EUnitFlag.UnitChanged) ? 1L : 0L), string.Empty);
                        stringBuilder.Append("},");
                    }
                }
                --stringBuilder.Length;
                stringBuilder.Append("],");
            }
            stringBuilder.Append("\"status\":\"");
            switch (result)
            {
            case BtlResultTypes.Win:
                stringBuilder.Append("win");
                break;

            case BtlResultTypes.Lose:
                stringBuilder.Append("lose");
                break;

            case BtlResultTypes.Retire:
                stringBuilder.Append("retire");
                break;

            case BtlResultTypes.Cancel:
                stringBuilder.Append("cancel");
                break;
            }
            stringBuilder.Append("\"");
            stringBuilder.Append(",\"turn\":");
            stringBuilder.Append(actCount);
            stringBuilder.Append(",\"round\":");
            stringBuilder.Append(round);
            stringBuilder.Append(",\"floor\":");
            stringBuilder.Append(floor);
            if (result == BtlResultTypes.Lose)
            {
                stringBuilder.Append(",\"edeck\":[");
                List <Unit> unitList = new List <Unit>((IEnumerable <Unit>)Enemy);
                unitList.RemoveAll((Predicate <Unit>)(x =>
                {
                    if (x.IsBreakObj)
                    {
                        return(!string.IsNullOrEmpty(x.CreateBreakObjId));
                    }
                    return(false);
                }));
                if (MonoSingleton <GameManager> .Instance.TowerResuponse.edeck != null)
                {
                    List <TowerResuponse.EnemyUnit> edeck = MonoSingleton <GameManager> .Instance.TowerResuponse.edeck;
                    int index1 = 0;
                    for (int index2 = 0; index2 < edeck.Count; ++index2)
                    {
                        if (edeck[index2].hp == 0)
                        {
                            stringBuilder.Append("{");
                            this.SetValue(ref stringBuilder, "\"eid\":\"", (long)index2, "\",");
                            this.SetValue(ref stringBuilder, "\"iname\":\"", edeck[index2].iname, "\",");
                            this.SetValue(ref stringBuilder, "\"hp\":", 0L);
                            this.SetValue(ref stringBuilder, "\"jewel\":", 0L, string.Empty);
                            stringBuilder.Append("},");
                        }
                        else
                        {
                            Unit unit = unitList[index1];
                            ++index1;
                            stringBuilder.Append("{");
                            this.SetValue(ref stringBuilder, "\"eid\":\"", (long)index2, "\",");
                            this.SetValue(ref stringBuilder, "\"iname\":\"", unit.UnitParam.iname, "\",");
                            if (unit.IsGimmick && !unit.IsDisableGimmick())
                            {
                                if (unit.IsBreakObj)
                                {
                                    this.SetValue(ref stringBuilder, "\"hp\":", (long)(int)unit.CurrentStatus.param.hp);
                                }
                                else
                                {
                                    this.SetValue(ref stringBuilder, "\"hp\":", 1L);
                                }
                            }
                            else
                            {
                                this.SetValue(ref stringBuilder, "\"hp\":", !unit.IsDead ? (long)(int)unit.CurrentStatus.param.hp : 0L);
                            }
                            this.SetValue(ref stringBuilder, "\"jewel\":", (long)(int)unit.CurrentStatus.param.mp, string.Empty);
                            stringBuilder.Append("},");
                        }
                    }
                }
                else
                {
                    for (int index = 0; index < unitList.Count; ++index)
                    {
                        Unit unit = unitList[index];
                        stringBuilder.Append("{");
                        this.SetValue(ref stringBuilder, "\"eid\":\"", (long)index, "\",");
                        this.SetValue(ref stringBuilder, "\"iname\":\"", unit.UnitParam.iname, "\",");
                        if (unit.IsGimmick && !unit.IsDisableGimmick())
                        {
                            if (unit.IsBreakObj)
                            {
                                this.SetValue(ref stringBuilder, "\"hp\":", (long)(int)unit.CurrentStatus.param.hp);
                            }
                            else
                            {
                                this.SetValue(ref stringBuilder, "\"hp\":", 1L);
                            }
                        }
                        else
                        {
                            this.SetValue(ref stringBuilder, "\"hp\":", !unit.IsDead ? (long)(int)unit.CurrentStatus.param.hp : 0L);
                        }
                        this.SetValue(ref stringBuilder, "\"jewel\":", (long)(int)unit.CurrentStatus.param.mp, string.Empty);
                        stringBuilder.Append("},");
                    }
                }
                --stringBuilder.Length;
                stringBuilder.Append("]");
            }
            SupportData supportData = GlobalVars.SelectedSupport.Get();

            if (GlobalVars.SelectedFriendID != null && supportData != null)
            {
                stringBuilder.Append(",\"help\":{\"fuid\":\"");
                stringBuilder.Append(GlobalVars.SelectedFriendID);
                stringBuilder.Append("\",\"cost\":");
                stringBuilder.Append(supportData.Cost);
                stringBuilder.Append("}");
            }
            if (missions != null && missions_value != null)
            {
                stringBuilder.Append(",");
                stringBuilder.Append("\"missions\":[");
                for (int index = 0; index < missions.Length; ++index)
                {
                    if (index > 0)
                    {
                        stringBuilder.Append(',');
                    }
                    stringBuilder.Append(missions[index].ToString());
                }
                stringBuilder.Append("]");
                stringBuilder.Append(",");
                stringBuilder.Append("\"missions_val\":[");
                for (int index = 0; index < missions_value.Length; ++index)
                {
                    if (index > 0)
                    {
                        stringBuilder.Append(',');
                    }
                    stringBuilder.Append(missions_value[index].ToString());
                }
                stringBuilder.Append("]");
            }
            else
            {
                stringBuilder.Append(",");
                stringBuilder.Append("\"missions\":[]");
                stringBuilder.Append(",");
                stringBuilder.Append("\"missions_val\":[]");
            }
            stringBuilder.Append("}");
            if (!string.IsNullOrEmpty(trophyprog))
            {
                stringBuilder.Append(",");
                stringBuilder.Append(trophyprog);
            }
            if (!string.IsNullOrEmpty(bingoprog))
            {
                stringBuilder.Append(",");
                stringBuilder.Append(bingoprog);
            }
            this.body     = WebAPI.GetRequestString(stringBuilder.ToString());
            this.callback = response;
        }
Beispiel #3
0
        private void Start()
        {
            SceneBattle instance = SceneBattle.Instance;

            if (this.mButtonObj != null)
            {
                this.mButtonObj.Clear();
            }
            else
            {
                this.mButtonObj = new List <GameObject>();
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ExitButton, (UnityEngine.Object)null))
            {
                this.ExitButton.SetActive(true);
            }
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)instance, (UnityEngine.Object)null))
            {
                return;
            }
            List <JSON_MyPhotonPlayerParam> audiencePlayer = instance.AudiencePlayer;
            List <Unit> allUnits = instance.Battle.AllUnits;

            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            InGameMenu_Audience.\u003CStart\u003Ec__AnonStorey33D startCAnonStorey33D = new InGameMenu_Audience.\u003CStart\u003Ec__AnonStorey33D();
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            for (startCAnonStorey33D.i = 0; startCAnonStorey33D.i < audiencePlayer.Count; ++startCAnonStorey33D.i)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                InGameMenu_Audience.\u003CStart\u003Ec__AnonStorey33E startCAnonStorey33E = new InGameMenu_Audience.\u003CStart\u003Ec__AnonStorey33E();
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                startCAnonStorey33E.units = audiencePlayer[startCAnonStorey33D.i].units;
                // ISSUE: reference to a compiler-generated field
                GenericSlot[] genericSlotArray = startCAnonStorey33D.i != 0 ? this.Units_2P : this.Units_1P;
                if (genericSlotArray != null)
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    InGameMenu_Audience.\u003CStart\u003Ec__AnonStorey33F startCAnonStorey33F = new InGameMenu_Audience.\u003CStart\u003Ec__AnonStorey33F();
                    // ISSUE: reference to a compiler-generated field
                    startCAnonStorey33F.\u003C\u003Ef__ref\u0024829 = startCAnonStorey33D;
                    // ISSUE: reference to a compiler-generated field
                    startCAnonStorey33F.\u003C\u003Ef__ref\u0024830 = startCAnonStorey33E;
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    for (startCAnonStorey33F.j = 0; startCAnonStorey33F.j < genericSlotArray.Length; ++startCAnonStorey33F.j)
                    {
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated field
                        if (startCAnonStorey33F.j < startCAnonStorey33E.units.Length)
                        {
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated field
                            genericSlotArray[startCAnonStorey33F.j].SetSlotData <UnitData>(startCAnonStorey33E.units[startCAnonStorey33F.j].unit);
                            // ISSUE: reference to a compiler-generated field
                            Button component = (Button)((Component)genericSlotArray[startCAnonStorey33F.j]).GetComponent <Button>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                            {
                                // ISSUE: reference to a compiler-generated method
                                Unit data = allUnits.Find(new Predicate <Unit>(startCAnonStorey33F.\u003C\u003Em__392));
                                if (data != null)
                                {
                                    DataSource.Bind <Unit>(((Component)component).get_gameObject(), data);
                                    this.mButtonObj.Add(((Component)component).get_gameObject());
                                    ((Selectable)component).set_interactable(!data.IsDeadCondition());
                                }
                            }
                        }
                        else
                        {
                            // ISSUE: reference to a compiler-generated field
                            genericSlotArray[startCAnonStorey33F.j].SetSlotData <UnitData>((UnitData)null);
                        }
                    }
                }
                // ISSUE: reference to a compiler-generated field
                Text text1 = startCAnonStorey33D.i != 0 ? this.Name2P : this.Name1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text1, (UnityEngine.Object)null))
                {
                    // ISSUE: reference to a compiler-generated field
                    text1.set_text(audiencePlayer[startCAnonStorey33D.i].playerName);
                }
                // ISSUE: reference to a compiler-generated field
                Text text2 = startCAnonStorey33D.i != 0 ? this.TotalAtk2P : this.TotalAtk1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text2, (UnityEngine.Object)null))
                {
                    // ISSUE: reference to a compiler-generated field
                    text2.set_text(audiencePlayer[startCAnonStorey33D.i].totalAtk.ToString());
                }
                // ISSUE: reference to a compiler-generated field
                Text text3 = startCAnonStorey33D.i != 0 ? this.Lv2P : this.Lv1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text2, (UnityEngine.Object)null))
                {
                    // ISSUE: reference to a compiler-generated field
                    text3.set_text(audiencePlayer[startCAnonStorey33D.i].playerLevel.ToString());
                }
            }
        }
        private void Start()
        {
            SceneBattle instance = SceneBattle.Instance;

            if (this.mButtonObj != null)
            {
                this.mButtonObj.Clear();
            }
            else
            {
                this.mButtonObj = new List <GameObject>();
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ExitButton, (UnityEngine.Object)null))
            {
                this.ExitButton.SetActive(true);
            }
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)instance, (UnityEngine.Object)null))
            {
                return;
            }
            List <JSON_MyPhotonPlayerParam> audiencePlayer = instance.AudiencePlayer;
            List <Unit> allUnits = instance.Battle.AllUnits;

            for (int i = 0; i < audiencePlayer.Count; ++i)
            {
                JSON_MyPhotonPlayerParam.UnitDataElem[] units = audiencePlayer[i].units;
                GenericSlot[] genericSlotArray = i != 0 ? this.Units_2P : this.Units_1P;
                if (genericSlotArray != null)
                {
                    for (int j = 0; j < genericSlotArray.Length; ++j)
                    {
                        if (j < units.Length)
                        {
                            genericSlotArray[j].SetSlotData <UnitData>(units[j].unit);
                            Button component = (Button)((Component)genericSlotArray[j]).GetComponent <Button>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                            {
                                Unit data = allUnits.Find((Predicate <Unit>)(un =>
                                {
                                    if (un.OwnerPlayerIndex == i + 1)
                                    {
                                        return(un.UnitData.UnitParam.iname == units[j].unit.UnitParam.iname);
                                    }
                                    return(false);
                                }));
                                if (data != null)
                                {
                                    DataSource.Bind <Unit>(((Component)component).get_gameObject(), data);
                                    this.mButtonObj.Add(((Component)component).get_gameObject());
                                    ((Selectable)component).set_interactable(!data.IsDeadCondition());
                                }
                            }
                        }
                        else
                        {
                            genericSlotArray[j].SetSlotData <UnitData>((UnitData)null);
                        }
                    }
                }
                Text text1 = i != 0 ? this.Name2P : this.Name1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text1, (UnityEngine.Object)null))
                {
                    text1.set_text(audiencePlayer[i].playerName);
                }
                Text text2 = i != 0 ? this.TotalAtk2P : this.TotalAtk1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text2, (UnityEngine.Object)null))
                {
                    text2.set_text(audiencePlayer[i].totalAtk.ToString());
                }
                Text text3 = i != 0 ? this.Lv2P : this.Lv1P;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)text2, (UnityEngine.Object)null))
                {
                    text3.set_text(audiencePlayer[i].playerLevel.ToString());
                }
            }
        }