コード例 #1
0
ファイル: DataTable.cs プロジェクト: nextgenhacker/GL.Servers
        /// <summary>
        /// Creates the data for the specified row.
        /// </summary>
        /// <param name="Row">The row.</param>
        internal Data Create(Row Row)
        {
            Data Data;

            switch (this.Index)
            {
            case 1:
            {
                Data = new Globals(Row, this);
                break;
            }

            case 5:
            {
                Data = new Resources(Row, this);
                break;
            }

            case 8:
            {
                Data = new Alliance_Badges(Row, this);
                break;
            }

            case 15:
            {
                Data = new Locations(Row, this);
                break;
            }

            case 16:
            {
                Data = new Characters(Row, this);
                break;
            }

            case 23:
            {
                Data = new Cards(Row, this);
                break;
            }

            case 28:
            {
                Data = new Player_Thumbnails(Row, this);
                break;
            }

            default:
            {
                Data = new Data(Row, this);
                break;
            }
            }

            return(Data);
        }
コード例 #2
0
        /// <summary>
        /// Processes this instance.
        /// </summary>
        internal override void Process()
        {
            Player_Thumbnails Thumbnail = CSV.Tables.GetWithGlobalID(this.GlobalID) as Player_Thumbnails;

            if (Thumbnail != null)
            {
                if (this.Device.Player.Info.Trophies >= Thumbnail.RequiredTotalTrophies)
                {
                    if (string.IsNullOrEmpty(Thumbnail.RequiredHero))
                    {
                        this.Device.Player.Info.Thumbnail = this.GlobalID;
                        this.Device.Player.Tick();
                    }
                    else
                    {
                        Characters Character = CSV.Tables.Get(Gamefile.Characters).GetData(Thumbnail.RequiredHero) as Characters;

                        if (Character != null)
                        {
                            if (this.Device.Player.Deck.ContainsKey(Character.GlobalID))
                            {
                                this.Device.Player.Info.Thumbnail = this.GlobalID;
                                this.Device.Player.Tick();
                            }
                            else
                            {
                                Logging.Error(this.GetType(), "Error when selecting the thumbnail n°" + this.GlobalID + ", the player don't have the required hero.");
                            }
                        }
                        else
                        {
                            Logging.Error(this.GetType(), "Error when selecting the thumbnail n°" + this.GlobalID + ", the Characters instance was null.");
                        }
                    }
                }
                else
                {
                    Logging.Error(this.GetType(), "Player don't have enough trophies to use the specified thumbnail.");
                }
            }
            else
            {
                Logging.Error(this.GetType(), "Error when selecting the thumbnail n°" + this.GlobalID + ", the Player_Thumbnails instance was null.");
            }
        }