Ejemplo n.º 1
0
        public bool Deserialize(Json_GachaHistoryItem json)
        {
            this.Init();
            if (json == null)
            {
                return(false);
            }
            string itype = json.itype;

            if (itype != null)
            {
                // ISSUE: reference to a compiler-generated field
                if (GachaHistoryData.\u003C\u003Ef__switch\u0024map19 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    GachaHistoryData.\u003C\u003Ef__switch\u0024map19 = new Dictionary <string, int>(3)
                    {
                        {
                            "item",
                            0
                        },
                        {
                            "unit",
                            1
                        },
                        {
                            "artifact",
                            2
                        }
                    };
                }
                int num;
                // ISSUE: reference to a compiler-generated field
                if (GachaHistoryData.\u003C\u003Ef__switch\u0024map19.TryGetValue(itype, out num))
                {
                    switch (num)
                    {
                    case 0:
                        this.type = GachaDropData.Type.Item;
                        this.item = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetItemParam(json.iname);

                        if (this.item == null)
                        {
                            DebugUtility.LogError("iname:" + json.iname + " => Not ItemParam!");
                            return(false);
                        }
                        this.rarity = (int)this.item.rare;
                        break;

                    case 1:
                        this.type = GachaDropData.Type.Unit;
                        this.unit = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetUnitParam(json.iname);

                        if (this.unit == null)
                        {
                            DebugUtility.LogError("iname:" + json.iname + " => Not UnitParam!");
                            return(false);
                        }
                        this.rarity = (int)this.unit.rare;
                        break;

                    case 2:
                        this.type     = GachaDropData.Type.Artifact;
                        this.artifact = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetArtifactParam(json.iname);

                        if (this.artifact == null)
                        {
                            DebugUtility.LogError("iname:" + json.iname + " => Not ArtifactParam!");
                            return(false);
                        }
                        if (json.rare != -1 && json.rare > this.artifact.raremax)
                        {
                            DebugUtility.LogError("武具:" + this.artifact.name + "の最大レアリティより大きい値が設定されています.");
                        }
                        else if (json.rare != -1 && json.rare < this.artifact.rareini)
                        {
                            DebugUtility.LogError("武具:" + this.artifact.name + "の初期レアリティより小さい値が設定されています.");
                        }
                        this.rarity = json.rare <= -1 ? this.artifact.rareini : Mathf.Min(Mathf.Max(this.artifact.rareini, json.rare), this.artifact.raremax);
                        break;
                    }
                }
            }
            this.num       = json.num;
            this.isConvert = json.convert_piece == 1;
            this.isNew     = json.is_new == 1;
            return(true);
        }
Ejemplo n.º 2
0
        public bool Deserialize(Json_GachaHistoryItem json)
        {
            this.Init();
            if (json == null)
            {
                return(false);
            }
            string itype = json.itype;

            if (itype != null)
            {
                // ISSUE: reference to a compiler-generated field
                if (GachaHistoryData.\u003C\u003Ef__switch\u0024mapF == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    GachaHistoryData.\u003C\u003Ef__switch\u0024mapF = new Dictionary <string, int>(3)
                    {
                        {
                            "item",
                            0
                        },
                        {
                            "unit",
                            1
                        },
                        {
                            "artifact",
                            2
                        }
                    };
                }
                int num;
                // ISSUE: reference to a compiler-generated field
                if (GachaHistoryData.\u003C\u003Ef__switch\u0024mapF.TryGetValue(itype, out num))
                {
                    switch (num)
                    {
                    case 0:
                        this.type = GachaDropData.Type.Item;
                        this.item = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetItemParam(json.iname);

                        break;

                    case 1:
                        this.type = GachaDropData.Type.Unit;
                        this.unit = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetUnitParam(json.iname);

                        break;

                    case 2:
                        this.type     = GachaDropData.Type.Artifact;
                        this.artifact = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam.GetArtifactParam(json.iname);

                        break;
                    }
                }
            }
            this.num       = json.num;
            this.isConvert = json.convert_piece == 1;
            this.isNew     = json.is_new == 1;
            return(true);
        }