예제 #1
0
        public bool Deserialize(Json_DropInfo json)
        {
            this.Init();
            if (json == null)
            {
                return(false);
            }
            string type = json.type;

            if (type != null)
            {
                // ISSUE: reference to a compiler-generated field
                if (GachaDropData.\u003C\u003Ef__switch\u0024mapD == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    GachaDropData.\u003C\u003Ef__switch\u0024mapD = new Dictionary <string, int>(3)
                    {
                        {
                            "item",
                            0
                        },
                        {
                            "unit",
                            1
                        },
                        {
                            "artifact",
                            2
                        }
                    };
                }
                int num;
                // ISSUE: reference to a compiler-generated field
                if (GachaDropData.\u003C\u003Ef__switch\u0024mapD.TryGetValue(type, out num))
                {
                    switch (num)
                    {
                    case 0:
                        this.type = GachaDropData.Type.Item;
                        this.item = MonoSingleton <GameManager> .Instance.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.unit = MonoSingleton <GameManager> .Instance.GetUnitParam(json.iname);

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

                    case 2:
                        this.artifact = MonoSingleton <GameManager> .Instance.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 : Math.Min(Math.Max(this.artifact.rareini, json.rare), this.artifact.raremax);
                        this.type   = GachaDropData.Type.Artifact;
                        break;
                    }
                }
            }
            this.num = json.num;
            if (0 < json.iname_origin.Length)
            {
                this.unitOrigin = MonoSingleton <GameManager> .Instance.GetUnitParam(json.iname_origin);
            }
            this.isNew = 1 == json.is_new;
            return(true);
        }
예제 #2
0
        public bool Deserialize(Json_DropInfo json)
        {
            this.Init();
            if (json == null)
            {
                return(false);
            }
            string type = json.type;

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

                        break;

                    case 1:
                        this.unit = MonoSingleton <GameManager> .Instance.GetUnitParam(json.iname);

                        this.type = GachaDropData.Type.Unit;
                        break;

                    case 2:
                        this.artifact = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(json.iname);

                        this.type = GachaDropData.Type.Artifact;
                        break;
                    }
                }
            }
            this.num = json.num;
            if (0 < json.iname_origin.Length)
            {
                this.unitOrigin = MonoSingleton <GameManager> .Instance.GetUnitParam(json.iname_origin);
            }
            this.isNew = 1 == json.is_new;
            return(true);
        }