Exemple #1
0
        /// <summary>
        /// ファイルデータからキャラクターインスタンスの作成
        /// </summary>
        private void AllCharacterData()
        {
            StreamReader sr       = new StreamReader(@"C:.\..\..\Characters.csv", Encoding.GetEncoding("UTF-8"));
            string       stResult = string.Empty;

            while (sr.Peek() >= 0)
            {
                string stBuffer = sr.ReadLine();
                stResult += stBuffer + Environment.NewLine;
            }
            sr.Close();

            string[] del = { "\r\n" };
            // 段らく区切りで分割して配列に格納する
            string[] CharacterData = stResult.Split(del, StringSplitOptions.None);
            CharacterDataCount = CharacterData.Length;
            string CharacterConfiguration;

            string[] eachCharacter;

            for (int i = 0; i < CharacterDataCount - 1; i++)
            {
                CharacterConfiguration = CharacterData[i];
                eachCharacter          = CharacterConfiguration.Split(',');

                Characters.Add(new CharacterData(int.Parse(eachCharacter[0]), int.Parse(eachCharacter[1]),
                                                 eachCharacter[2], eachCharacter[3], eachCharacter[4], eachCharacter[5],
                                                 eachCharacter[6], int.Parse(eachCharacter[7]), int.Parse(eachCharacter[8]), eachCharacter[9],
                                                 eachCharacter[10], eachCharacter[11], eachCharacter[12]));
            }
        }
    static void GenerateConfigurationFile()
    {
        BundleConfiguration bundleConfiguration = (BundleConfiguration)Resources.Load("BundleConfig");

        if (!bundleConfiguration)
        {
            Debug.LogError("Failed to find 'BundleConfig' file in Assets/Resources/");
            return;
        }

        CharacterConfiguration configuration = (CharacterConfiguration)Resources.Load("CharacterConfig");

        if (!configuration)
        {
            Debug.LogError("Failed to find 'CharacterConfig' file in Assets/Resources/");
            return;
        }

        StringBuilder sb     = new StringBuilder();
        JsonWriter    writer = new JsonWriter(sb);

        writer.PrettyPrint = true;

        writer.WriteObjectStart();
        writer.WritePropertyName("Prefab");
        writer.Write(configuration.prefab.name);

        writer.WritePropertyName("Animations");
        writer.WriteArrayStart();

        foreach (AnimationInfos info in configuration.animationsInfos)
        {
            JsonAnimInfos animInfo = new JsonAnimInfos();

            animInfo.name = info.name;
            if (info.sprite)
            {
                animInfo.image = info.sprite.name;
            }
            if (info.audioClip)
            {
                animInfo.audio = info.audioClip.name;
            }

            writer.Write(JsonMapper.ToJson(animInfo));
        }

        writer.WriteArrayEnd();
        writer.WriteObjectEnd();

        string       path       = "Assets/Characters/" + bundleConfiguration.targetModelFolder + "/" + bundleConfiguration.bundleName + "_config.json";
        StreamWriter fileWriter = new StreamWriter(path);

        fileWriter.WriteLine(sb.ToString());
        fileWriter.Close();
    }
Exemple #3
0
        public GameWorld(ILogger <GameWorld> logger, IBackgroundTaskQueue taskQueue, IDatabasePreloader databasePreloader, IMapsLoader mapsLoader, CharacterConfiguration characterConfig)
        {
            _logger            = logger;
            _taskQueue         = taskQueue;
            _databasePreloader = databasePreloader;
            _mapsLoader        = mapsLoader;
            _characterConfig   = characterConfig;

            InitMaps();
        }
Exemple #4
0
        public Character(World world, CharacterConfiguration configuration, string colliderName)
            : base(world)
        {
            this.Configuration = configuration;
            if (Configuration.EntityNames.Length == 0)
                throw new ArgumentException("At least one body entity must be provided.");

            CharacterNode = World.WorldNode.CreateChildSceneNode();
            EyeNode = CharacterNode.CreateChildSceneNode(new Vector3(0, 1.7f, 0));
            FirstPersonModel = new FirstPersonModel(this, EyeNode);
            FirstPersonModel.Visible = false;
            ThirdPersonModel = new ThirdPersonModel(this, CharacterNode, Configuration.EntityNames);

            BodyCollisionTree = new BodyCollisionTree(ThirdPersonModel.BodyEntities[0], AllLowerBodyAnimations.Concat(AllUpperBodyAnimations));
            BodyColliders = ColliderLoader.ParseColliders(colliderName, BodyCollisionTree, "Alpha_").ToArray();

            BoundingSphere = new SphereNode(CharacterNode, new Vector3(0, 1, 0), 2);
            SimpleCollider = new UprightCylinderNode(CharacterNode, Vector3.ZERO, 1.7f, 0.7f);
            AnimationManagerMapper.Add(
                AnimationKind.LowerBody,
                new AnimationManager(
                    AllLowerBodyAnimations,
                    ThirdPersonModel.BodyEntities,
                    "Idle"
                )
            );
            AnimationManagerMapper.Add(
                AnimationKind.UpperBody,
                new AnimationManager(
                    AllUpperBodyAnimations,
                    ThirdPersonModel.BodyEntities,
                    "Wield_USP"
                )
            );
            Camera = World.CreateCamera(Vector3.ZERO, MathHelper.Forward);
            EyeNode.AttachObject(Camera);
            ViewFrustum = new FrustumNode(Camera);

            SpecialMoveHandlers = new SpecialMoveHandler[3];
            Reset();
        }
        public CharacterMovementActuator(Transform transform, Rigidbody rigidbody, AgentNavigator agentNavigator, IAgentAI agentAI, SwampCollisionListener swampCollisionListener,
                                         ICommandProvider commandProvider, CharacterConfiguration configuration)
        {
            _transform       = transform;
            _rigidbody       = rigidbody;
            _agentNavigator  = agentNavigator;
            _commandProvider = commandProvider;
            _configuration   = configuration;

            _attackMovementCanStart = false;
            _attackMovementMustEnd  = false;
            _movementSpeedModifier  = 1.0f;

            AnimationCallbackHandler animationCallbackHandler = _transform.GetComponentInChildren <AnimationCallbackHandler>();

            animationCallbackHandler.AttackMovementStartEvent += HandleAttackMovementStartEvent;
            animationCallbackHandler.AttackMovementEndEvent   += HandleAttackMovementEndEvent;

            agentAI.SetTargetEvent += HandleSetTargetEvent;

            swampCollisionListener.SwampEntryEvent += HandleSwampEntryEvent;
        }
        /// <inheritdoc />
        public void ConfigureServices(IServiceCollection services)
        {
            // Add options.
            services.AddOptions <ImgeneusServerOptions>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("TcpServer").Bind(settings));
            services.AddOptions <WorldConfiguration>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("WorldServer").Bind(settings));
            services.AddOptions <DatabaseConfiguration>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("Database").Bind(settings));
            services.AddOptions <InterServerConfig>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("InterServer").Bind(settings));
            services.AddOptions <GuildConfiguration>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("Game:Guild").Bind(settings));

            services.RegisterDatabaseServices();

            services.AddHandlers();

            services.AddSingleton <IInterServerClient, ISClient>();
            services.AddSingleton <IWorldServer, WorldServer>();
            services.AddSingleton <IGamePacketFactory, GamePacketFactory>();
            services.AddSingleton <IGameWorld, GameWorld>();
            services.AddSingleton <IGameDefinitionsPreloder, GameDefinitionsPreloder>();
            services.AddSingleton <IMapsLoader, MapsLoader>();
            services.AddSingleton <IMapFactory, MapFactory>();
            services.AddSingleton <IMobFactory, MobFactory>();
            services.AddSingleton <INpcFactory, NpcFactory>();
            services.AddSingleton <IObeliskFactory, ObeliskFactory>();
            services.AddSingleton <ICharacterConfiguration, CharacterConfiguration>((x) => CharacterConfiguration.LoadFromConfigFile());
            services.AddSingleton <IGuildConfiguration, GuildConfiguration>((x) => GuildConfiguration.LoadFromConfigFile());
            services.AddSingleton <IGuildHouseConfiguration, GuildHouseConfiguration>((x => GuildHouseConfiguration.LoadFromConfigFile()));
            services.AddSingleton <IItemEnchantConfiguration, ItemEnchantConfiguration>((x => ItemEnchantConfiguration.LoadFromConfigFile()));
            services.AddSingleton <IMoveTownsConfiguration, MoveTownsConfiguration>((x => MoveTownsConfiguration.LoadFromConfigFile()));
            services.AddSingleton <IItemCreateConfiguration, ItemCreateConfiguration>((x => ItemCreateConfiguration.LoadFromConfigFile()));
            services.AddSingleton <IChatManager, ChatManager>();
            services.AddSingleton <INoticeManager, NoticeManager>();
            services.AddSingleton <IGuildRankingManager, GuildRankingManager>();
            services.AddSingleton <IEtinManager, EtinManager>();
            services.AddSingleton <IDatabasePreloader, DatabasePreloader>((x) =>
            {
                using (var scope = x.CreateScope())
                {
                    var logger = scope.ServiceProvider.GetRequiredService <ILogger <DatabasePreloader> >();
                    var db     = scope.ServiceProvider.GetRequiredService <IDatabase>();
                    return(new DatabasePreloader(logger, db));
                }
            });

            services.AddScoped <ICharacterFactory, CharacterFactory>();
            services.AddScoped <ISelectionScreenManager, SelectionScreenManager>();
            services.AddScoped <IGameSession, GameSession>();
            services.AddScoped <IStatsManager, StatsManager>();
            services.AddScoped <ICountryProvider, CountryProvider>();
            services.AddScoped <ILevelProvider, LevelProvider>();
            services.AddScoped <ILevelingManager, LevelingManager>();
            services.AddScoped <IHealthManager, HealthManager>();
            services.AddScoped <ISpeedManager, SpeedManager>();
            services.AddScoped <IAttackManager, AttackManager>();
            services.AddScoped <ISkillsManager, SkillsManager>();
            services.AddScoped <IBuffsManager, BuffsManager>();
            services.AddScoped <IElementProvider, ElementProvider>();
            services.AddScoped <IInventoryManager, InventoryManager>();
            services.AddScoped <IStealthManager, StealthManager>();
            services.AddScoped <IKillsManager, KillsManager>();
            services.AddScoped <IVehicleManager, VehicleManager>();
            services.AddScoped <IShapeManager, ShapeManager>();
            services.AddScoped <IMovementManager, MovementManager>();
            services.AddScoped <ILinkingManager, LinkingManager>();
            services.AddScoped <IAdditionalInfoManager, AdditionalInfoManager>();
            services.AddScoped <IMapProvider, MapProvider>();
            services.AddScoped <ITeleportationManager, TeleportationManager>();
            services.AddScoped <IDyeingManager, DyeingManager>();
            services.AddScoped <IPartyManager, PartyManager>();
            services.AddScoped <ITradeManager, TradeManager>();
            services.AddScoped <IFriendsManager, FriendsManager>();
            services.AddScoped <IDuelManager, DuelManager>();
            services.AddScoped <IGuildManager, GuildManager>();
            services.AddScoped <IBankManager, BankManager>();
            services.AddScoped <IQuestsManager, QuestsManager>();
            services.AddScoped <IUntouchableManager, UntouchableManager>();
            services.AddScoped <IWarehouseManager, WarehouseManager>();
            services.AddScoped <IAIManager, AIManager>();
            services.AddScoped <IShopManager, ShopManager>();
            services.AddScoped <ISkillCastingManager, SkillCastingManager>();
            services.AddScoped <ICastProtectionManager, CastProtectionManager>();

            services.AddTransient <ICryptoManager, CryptoManager>();
            services.AddTransient <ILogsDatabase, LogsDbContext>();
            services.AddTransient <ITimeService, TimeService>();

            // Add admin website
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddDefaultIdentity <DbUser>(options =>
            {
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireUppercase       = false;
                options.Password.RequireLowercase       = false;
                options.Password.RequiredLength         = 1;
            })
            .AddRoles <DbRole>()
            .AddEntityFrameworkStores <DatabaseContext>();
        }
Exemple #7
0
        /// <inheritdoc />
        public void ConfigureServices(IServiceCollection services)
        {
            // Add options.
            services.AddOptions <WorldConfiguration>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("WorldServer").Bind(settings));
            services.AddOptions <DatabaseConfiguration>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("Database").Bind(settings));
            services.AddOptions <InterServerConfig>()
            .Configure <IConfiguration>((settings, configuration) => configuration.GetSection("InterServer").Bind(settings));

            services.RegisterDatabaseServices();

            services.AddSingleton <IInterServerClient, ISClient>();
            services.AddSingleton <IWorldServer, WorldServer>();
            services.AddSingleton <IGameWorld, GameWorld>();
            services.AddSingleton <ISelectionScreenFactory, SelectionScreenFactory>();
            services.AddSingleton <IMapsLoader, MapsLoader>();
            services.AddSingleton <IMapFactory, MapFactory>();
            services.AddSingleton <IMobFactory, MobFactory>();
            services.AddSingleton <INpcFactory, NpcFactory>();
            services.AddSingleton <IObeliskFactory, ObeliskFactory>();
            services.AddSingleton <ICharacterFactory, CharacterFactory>();
            services.AddSingleton <ICharacterConfiguration, CharacterConfiguration>((x) => CharacterConfiguration.LoadFromConfigFile());
            services.AddSingleton <IDatabasePreloader, DatabasePreloader>((x) =>
            {
                using (var scope = x.CreateScope())
                {
                    var logger = scope.ServiceProvider.GetRequiredService <ILogger <DatabasePreloader> >();
                    var db     = scope.ServiceProvider.GetRequiredService <IDatabase>();
                    return(new DatabasePreloader(logger, db));
                }
            });
            services.AddSingleton <IChatManager, ChatManager>();
            services.AddSingleton <INoticeManager, NoticeManager>();

            services.AddTransient <ILogsDatabase, LogsDbContext>();
            services.AddTransient <ILinkingManager, LinkingManager>();
            services.AddTransient <IDyeingManager, DyeingManager>();
            services.AddTransient <IGuildManager, GuildManager>();

            services.AddSingleton <IBackgroundTaskQueue, BackgroundTaskQueue>();
            services.AddHostedService <DatabaseWorker>();
        }
Exemple #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="playerID">the ID of the player revealing the clue</param>
        /// <param name="clueID">The ID of the clue being revealed</param>
        /// <param name="ClueType">The Type of clue being revealed: Character, Weapon, Room</param>
        public static Clue RevealClue(int playerID, int clueID, string ClueType, int suggestionID)
        {
            Clue revealedClue = new Clue();

            try
            {
                using (ClueLessContext db = new ClueLessContext())
                {
                    //Get the database suggestion object
                    Database.DataModels.Suggestion suggestion = db.Suggestions.Where(x => x.ID == suggestionID).FirstOrDefault();

                    //Update the suggestion's author's clue tracker based on the clue type
                    switch (ClueType)
                    {
                    case "Character":
                        db.PlayersToCharcters.Add(new Database.DataModels.PlayerToCharacter
                        {
                            PlayerID = suggestion.PlayerID,
                            CharacterConfigurationID = clueID,
                        });
                        db.SaveChanges();

                        //Pull the information for the clue to be returned
                        CharacterConfiguration characterConfiguration = db.CharacterConfigurations.Where(x => x.ID == clueID).FirstOrDefault();
                        revealedClue = new Clue
                        {
                            ID   = characterConfiguration.ID,
                            Name = characterConfiguration.Character.Name,
                        };

                        break;

                    case "Weapon":
                        db.PlayersToWeapons.Add(new Database.DataModels.PlayerToWeapon
                        {
                            PlayerID = suggestion.PlayerID,
                            WeaponConfigurationID = clueID
                        });
                        db.SaveChanges();

                        WeaponConfiguration weaponConfiguration = db.WeaponConfigurations.Where(x => x.ID == clueID).FirstOrDefault();
                        revealedClue = new Clue {
                            ID = weaponConfiguration.ID, Name = weaponConfiguration.Weapon.Name
                        };

                        break;

                    case "Room":
                        db.PlayersToLocations.Add(new Database.DataModels.PlayerToLocation
                        {
                            PlayerID   = suggestion.PlayerID,
                            PositionID = clueID
                        });
                        db.SaveChanges();

                        //Pull the information for the clue to be returned
                        Position position = db.Positions.Where(x => x.ID == clueID).FirstOrDefault();
                        revealedClue = new Clue {
                            ID = position.ID, Name = position.Location.LocationName
                        };

                        break;

                    default:
                        throw new ArgumentException();
                    }
                }
            }catch (Exception e)
            {
                Console.WriteLine(e.Message + Environment.NewLine + e.StackTrace);
            }

            return(revealedClue);
        }
Exemple #9
0
        public Clue RevealClue(int locationID, int gameID, int playerID)
        {
            Clue revealedClue = new Clue();

            using (ClueLessContext db = new ClueLessContext())
            {
                //Get the ClueLocation Object
                PositionToClue clue = db.PositionsToClues.Where(x => x.PositionID == locationID && x.GameID == gameID).FirstOrDefault();
                //Based on the clue type added the clue in the room to the player's  tracking table if it does not already exist
                int clueID = -1;
                switch (clue.ClueType)
                {
                case "Character":
                    //Look for the clue in the player's tracked character clues
                    clueID = db.PlayersToCharcters.Where(x => x.CharacterConfigurationID == clue.ClueID && x.PlayerID == playerID).Select(x => x.ID).FirstOrDefault();
                    //if it doesn't exist, add it to the player's tracker character clues
                    if (clueID <= 0)
                    {
                        db.PlayersToCharcters.Add(new PlayerToCharacter
                        {
                            PlayerID = playerID,
                            CharacterConfigurationID = clue.ClueID,
                        });
                        db.SaveChanges();
                    }
                    //Pull the information for the clue to be returned
                    CharacterConfiguration characterConfiguration = db.CharacterConfigurations.Where(x => x.ID == clue.ClueID).FirstOrDefault();
                    revealedClue = new Clue
                    {
                        ID   = characterConfiguration.ID,
                        Name = characterConfiguration.Character.Name,
                    };

                    break;

                case "Weapon":
                    //Look for the clue in the player's tracked weapon clues
                    clueID = db.PlayersToWeapons.Where(x => x.WeaponConfigurationID == clue.ClueID && x.PlayerID == playerID).Select(x => x.ID).FirstOrDefault();
                    //if it doesn't exist, add it to the player's tracked weapon clues
                    if (clueID <= 0)
                    {
                        db.PlayersToWeapons.Add(new PlayerToWeapon
                        {
                            PlayerID = playerID,
                            WeaponConfigurationID = clue.ClueID
                        });
                        db.SaveChanges();
                    }

                    //Pull the informaton for the clue to be returned
                    WeaponConfiguration weaponConfiguration = db.WeaponConfigurations.Where(x => x.ID == clue.ClueID).FirstOrDefault();
                    revealedClue = new Clue {
                        ID = weaponConfiguration.ID, Name = weaponConfiguration.Weapon.Name
                    };

                    break;

                case "Room":
                    clueID = db.PlayersToLocations.Where(x => x.PositionID == clue.ClueID && x.PlayerID == playerID).Select(x => x.ID).FirstOrDefault();
                    if (clueID > 0)
                    {
                        db.PlayersToLocations.Add(new PlayerToLocation
                        {
                            PlayerID   = playerID,
                            PositionID = clue.ClueID
                        });
                        db.SaveChanges();
                    }

                    //Pull the information for the clue to be returned
                    Position position = db.Positions.Where(x => x.ID == clue.ClueID).FirstOrDefault();
                    revealedClue = new Clue {
                        ID = position.ID, Name = position.Location.LocationName
                    };
                    break;

                default:
                    throw new ArgumentException();
                }

                // return the clue object
                return(revealedClue);
            }
        }
 void RemoveCharacterConfiguration(CharacterConfiguration config)
 {
     _myTarget.CharacterConfigurations.Remove(config);
 }
    public override void OnInspectorGUI()
    {
        Undo.RecordObject(target, "inspector");
        List <ArenaConfiguration>      arenaConfigToRemove     = new List <ArenaConfiguration>();
        List <AGameRulesConfiguration> modeConfigToRemove      = new List <AGameRulesConfiguration>();
        List <CharacterConfiguration>  characterConfigToRemove = new List <CharacterConfiguration>();
        List <MapConfiguration>        mapConfigToRemove       = new List <MapConfiguration>();

        GUIStyle titleStyle = new GUIStyle("button");

        titleStyle.alignment = TextAnchor.MiddleCenter;
        titleStyle.fontSize  = 20;
        titleStyle.fontStyle = FontStyle.Bold;

        SetGUIBackgroundColor(Color.white * 0.75f);
        EditorGUILayout.BeginVertical("box");
        {
            SetGUIBackgroundColor(Color.white);
            EditorGUILayout.BeginVertical("box");
            {
                GUIStyle style = new GUIStyle(EditorStyles.boldLabel);
                style.richText  = true;
                style.alignment = TextAnchor.MiddleCenter;
                style.fontSize  = 15;
                GUILayout.Label("Dynamic Config v" + DynamicConfig.VERSION, style, GUILayout.Height(20));
            }
            EditorGUILayout.EndVertical();
            SetGUIBackgroundColor(Color.white * 0.75f);

            EditorGUILayout.Separator();

            SetGUIBackgroundColor(Color.white);
            #region Characters
            EditorGUILayout.BeginVertical("box");
            {
                EditorGUILayout.LabelField("Characters Configurations", EditorStyles.boldLabel);

                for (int i = 0; i < _myTarget.CharacterConfigurations.Count; ++i)
                {
                    CharacterConfiguration config = _myTarget.CharacterConfigurations[i];

                    EditorGUILayout.BeginHorizontal("box");
                    {
                        EditorGUILayout.BeginVertical("box");
                        {
                            config.Name          = EditorGUILayout.TextField("Character Name: ", config.Name);
                            config.Configuration = (PlayerController)EditorGUILayout.ObjectField(config.Configuration, typeof(PlayerController), false);
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(GUILayout.Width(25));
                        {
                            GUIStyle styleButton = new GUIStyle(EditorStyles.miniButtonRight);
                            SetGUIBackgroundColor(Color.red);
                            if (GUILayout.Button("x", styleButton, GUILayout.Width(25), GUILayout.Height(20)))
                            {
                                characterConfigToRemove.Add(config);
                            }
                            SetGUIBackgroundColor(Color.white);
                        }
                        EditorGUILayout.EndVertical();
                    }
                    EditorGUILayout.EndHorizontal();

                    _myTarget.CharacterConfigurations[i] = config;
                }

                for (var r = 0; r < characterConfigToRemove.Count; ++r)
                {
                    RemoveCharacterConfiguration(characterConfigToRemove[r]);
                }

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                {
                    GUI.color = Color.cyan;
                    if (GUILayout.Button("Add Character Configuration"))
                    {
                        AddCharacterConfiguration();
                    }
                    GUI.color = Color.green;
                    if (GUILayout.Button("Generate Character Configuration Enum"))
                    {
                        SaveCharactersEnums();
                    }
                    GUI.color = _defaultColor;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
            #endregion
            EditorGUILayout.Separator();
            #region Arena
            EditorGUILayout.BeginVertical("box");
            {
                EditorGUILayout.LabelField("Arenas Configurations", EditorStyles.boldLabel);

                for (int i = 0; i < _myTarget.ArenaConfigurations.Count; ++i)
                {
                    ArenaConfiguration config = _myTarget.ArenaConfigurations[i];

                    EditorGUILayout.BeginHorizontal("box");
                    {
                        EditorGUILayout.BeginVertical("box");
                        {
                            config.Name          = EditorGUILayout.TextField("Arena Name: ", config.Name);
                            config.Configuration = (ArenaConfiguration_SO)EditorGUILayout.ObjectField(config.Configuration, typeof(ArenaConfiguration_SO), false);
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(GUILayout.Width(25));
                        {
                            GUIStyle styleButton = new GUIStyle(EditorStyles.miniButtonRight);
                            SetGUIBackgroundColor(Color.red);
                            if (GUILayout.Button("x", styleButton, GUILayout.Width(25), GUILayout.Height(20)))
                            {
                                arenaConfigToRemove.Add(config);
                            }
                            SetGUIBackgroundColor(Color.white);
                        }
                        EditorGUILayout.EndVertical();
                    }
                    EditorGUILayout.EndHorizontal();

                    _myTarget.ArenaConfigurations[i] = config;
                }

                for (var r = 0; r < arenaConfigToRemove.Count; ++r)
                {
                    RemoveArenaConfiguration(arenaConfigToRemove[r]);
                }

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                {
                    GUI.color = Color.cyan;
                    if (GUILayout.Button("Add Arena Configuration"))
                    {
                        AddArenaConfiguration();
                    }
                    GUI.color = Color.green;
                    if (GUILayout.Button("Generate Arena Configuration Enum"))
                    {
                        SaveArenasEnums();
                    }
                    GUI.color = _defaultColor;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
            #endregion
            EditorGUILayout.Separator();
            #region Mode
            EditorGUILayout.BeginVertical("box");
            {
                EditorGUILayout.LabelField("Modes Configurations", EditorStyles.boldLabel);

                for (int i = 0; i < _myTarget.ModeConfigurations.Count; ++i)
                {
                    AGameRulesConfiguration config = _myTarget.ModeConfigurations[i];

                    EditorGUILayout.BeginHorizontal("box");
                    {
                        EditorGUILayout.BeginVertical("box");
                        {
                            config.Name          = EditorGUILayout.TextField("Mode Name: ", config.Name);
                            config.Configuration = (AGameRules)EditorGUILayout.ObjectField(config.Configuration, typeof(AGameRules), false);
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(GUILayout.Width(25));
                        {
                            GUIStyle styleButton = new GUIStyle(EditorStyles.miniButtonRight);
                            SetGUIBackgroundColor(Color.red);
                            if (GUILayout.Button("x", styleButton, GUILayout.Width(25), GUILayout.Height(20)))
                            {
                                modeConfigToRemove.Add(config);
                            }
                            SetGUIBackgroundColor(Color.white);
                        }
                        EditorGUILayout.EndVertical();
                    }
                    EditorGUILayout.EndHorizontal();

                    _myTarget.ModeConfigurations[i] = config;
                }

                for (var r = 0; r < modeConfigToRemove.Count; ++r)
                {
                    RemoveModeConfiguration(modeConfigToRemove[r]);
                }

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                {
                    GUI.color = Color.cyan;
                    if (GUILayout.Button("Add Mode Configuration"))
                    {
                        AddModeConfiguration();
                    }
                    GUI.color = Color.green;
                    if (GUILayout.Button("Generate Mode Configuration Enum"))
                    {
                        SaveModesEnums();
                    }
                    GUI.color = _defaultColor;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
            #endregion
            EditorGUILayout.Separator();
            #region Map
            EditorGUILayout.BeginVertical("box");
            {
                EditorGUILayout.LabelField("Maps Configurations", EditorStyles.boldLabel);

                for (int i = 0; i < _myTarget.MapsConfigurations.Count; ++i)
                {
                    MapConfiguration config = _myTarget.MapsConfigurations[i];

                    EditorGUILayout.BeginHorizontal("box");
                    {
                        EditorGUILayout.BeginVertical("box");
                        {
                            config.Name          = EditorGUILayout.TextField("Map Name: ", config.Name);
                            config.Configuration = (MapConfiguration_SO)EditorGUILayout.ObjectField(config.Configuration, typeof(MapConfiguration_SO), false);
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(GUILayout.Width(25));
                        {
                            GUIStyle styleButton = new GUIStyle(EditorStyles.miniButtonRight);
                            SetGUIBackgroundColor(Color.red);
                            if (GUILayout.Button("x", styleButton, GUILayout.Width(25), GUILayout.Height(20)))
                            {
                                mapConfigToRemove.Add(config);
                            }
                            SetGUIBackgroundColor(Color.white);
                        }
                        EditorGUILayout.EndVertical();
                    }
                    EditorGUILayout.EndHorizontal();

                    _myTarget.MapsConfigurations[i] = config;
                }

                for (var r = 0; r < mapConfigToRemove.Count; ++r)
                {
                    RemoveMapConfiguration(mapConfigToRemove[r]);
                }

                EditorGUILayout.Separator();

                EditorGUILayout.BeginHorizontal();
                {
                    GUI.color = Color.cyan;
                    if (GUILayout.Button("Add Map Configuration"))
                    {
                        AddMapConfiguration();
                    }
                    GUI.color = Color.green;
                    if (GUILayout.Button("Generate Map Configuration Enum"))
                    {
                        SaveMapsEnums();
                    }
                    GUI.color = _defaultColor;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
            #endregion
            EditorGUILayout.Separator();

            GUI.color = Color.green;
            if (GUILayout.Button("Generate All Enums", titleStyle))
            {
                SaveCharactersEnums();
                SaveArenasEnums();
                SaveModesEnums();
                SaveMapsEnums();
                AssetDatabase.Refresh();
            }
            GUI.color = _defaultColor;
        }
        EditorGUILayout.EndVertical();

        SetDefaultGUIBackgroundColor();
        SceneView.RepaintAll();
    }
 public CharacterCreateRequestHandler(ICharacterService characterService, IAccountService accountService, WorldConfiguration worldConfiguration)
 {
     _characterService       = characterService;
     _accountService         = accountService;
     _characterConfiguration = worldConfiguration.CharacterConfiguration;
 }