Exemplo n.º 1
0
        public static void Initialize()
        {
            try
            {
                ModSettings.Version = ModAPI.Mods.LoadedMods["ChampionsOfForest"].Version;
                if (SteamDSConfig.isDedicated)
                {
                    ModAPI.Log.Write("isDedicated true");
                    ModSettings.IsDedicated = true;
                }

                if (ModSettings.IsDedicated)
                {
                    DedicatedServer.COTFDS.ReadDediServerConfig();
                    new GameObject("NetworkManagerObj").AddComponent <Network.NetworkManager>();
                    GameObject go = new GameObject("Playerobj");
                    go.AddComponent <ModReferences>();
                    ItemDataBase.Initialize();
                    EnemyManager.Initialize();
                    Network.NetworkManager.instance.onGetMessage += Network.CommandReader.OnCommand;
                    ExpEvents.Initialize();
                    return;
                }

                ModSettings.DifficultyChosen = false;
                if (SceneManager.GetActiveScene().name == "TitleScene")
                {
                    new GameObject("Resource Manager").AddComponent <ResourceLoader>();
                    ResourceLoader.InMainMenu = true;
                    MainMenuVisual.Create();
                }
                else
                {
                    ResourceLoader.InMainMenu = false;
                    NetworkPlayerStats.Reset();
                    COTFEvents.ClearEvents();

                    new GameObject("NetworkManagerObj").AddComponent <Network.NetworkManager>();
                    GameObject go           = new GameObject("__COTFPlayerobj__");
                    var        moddedPlayer = go.AddComponent <ModdedPlayer>();
                    moddedPlayer.SetStats();
                    go.AddComponent <Inventory>();
                    go.AddComponent <ModReferences>();
                    go.AddComponent <SpellCaster>();
                    go.AddComponent <ClientItemPicker>();
                    go.AddComponent <MeteorSpawner>();
                    go.AddComponent <BlackFlame>();
                    go.AddComponent <AsyncHit>();
                    go.AddComponent <GlobalSFX>();
                    go.AddComponent <TheFartCreator>();
                    go.AddComponent <RCoroutines>();
                    go.AddComponent <ActiveSpellManager>();
                    new GameObject("MainMenuObj").AddComponent <MainMenu>();


                    // go.AddComponent<Crafting>();
                    Network.CommandInitializer.Init();
                    CustomCrafting.Init();
                    BuffDB.FillBuffList();
                    ItemDataBase.Initialize();
                    SpellDataBase.Initialize();
                    EnemyManager.Initialize();
                    Network.NetworkManager.instance.onGetMessage += Network.CommandReader.OnCommand;
                    Buildings.InitBuildings();
                    PerkDatabase.FillPerkList();
                    ExpEvents.Initialize();
                    Portal.InitializePortals();
                    CoopCustomWeapons.Init();
                    BallLightning.InitPrefab();
                    ResourceInitializer.SetupMeshesFromOtherAssets();
                    Cataclysm.AssignPrefabs();
                    MarkEnemy.AssignTextures();
                }
            }
            catch (Exception ex)
            {
                ModAPI.Log.Write(ex.ToString());
            }
        }
Exemplo n.º 2
0
        public static void Initialize()
        {
            try
            {
                ModSettings.Version = ModAPI.Mods.LoadedMods["ChampionsOfForest"].Version;

                if (SteamDSConfig.isDedicated)
                {
                    ModAPI.Log.Write("isDedicated true");
                    ModSettings.IsDedicated = true;
                }

                if (ModSettings.IsDedicated)
                {
                    ReadDediServerConfig();



                    new GameObject("NetworkManagerObj").AddComponent <Network.NetworkManager>();
                    GameObject go = new GameObject("Playerobj");
                    //go.AddComponent<ModdedPlayer>();
                    //go.AddComponent<Inventory>();
                    go.AddComponent <ModReferences>();
                    //go.AddComponent<SpellCaster>();
                    //go.AddComponent<ClinetItemPicker>();
                    //go.AddComponent<MeteorSpawner>();
                    //BuffDB.FillBuffList();
                    ItemDataBase.Initialize();
                    //SpellDataBase.Initialize();
                    EnemyManager.Initialize();
                    //new GameObject("MainMenuObj").AddComponent<MainMenu>();
                    Network.NetworkManager.instance.onGetMessage += Network.CommandReader.OnCommand;
                    //Res.Buildings.InitBuildings();
                    ExpEvents.Initialize();
                    return;
                }

                ModSettings.DifficultyChoosen = false;
                if (SceneManager.GetActiveScene().name == "TitleScene")
                {
                    new GameObject("Resource Manager").AddComponent <Res.ResourceLoader>();
                    Res.ResourceLoader.InMainMenu = true;
                }
                else
                {
                    Res.ResourceLoader.InMainMenu = false;

                    new GameObject("NetworkManagerObj").AddComponent <Network.NetworkManager>();
                    GameObject go = new GameObject("__COTFPlayerobj__");
                    go.AddComponent <ModdedPlayer>();
                    go.AddComponent <Inventory>();
                    go.AddComponent <ModReferences>();
                    go.AddComponent <SpellCaster>();
                    go.AddComponent <ClinetItemPicker>();
                    go.AddComponent <MeteorSpawner>();
                    go.AddComponent <BlackFlame>();
                    BuffDB.FillBuffList();
                    ItemDataBase.Initialize();
                    SpellDataBase.Initialize();
                    EnemyManager.Initialize();
                    new GameObject("MainMenuObj").AddComponent <MainMenu>();
                    Network.NetworkManager.instance.onGetMessage += Network.CommandReader.OnCommand;
                    Res.Buildings.InitBuildings();
                    Perk.FillPerkList();
                    ExpEvents.Initialize();
                    Portal.InitializePortals();
                }
            }
            catch (Exception ex)
            {
                ModAPI.Log.Write(ex.ToString());
            }
        }