Exemple #1
0
    void OnEnable()
    {
        if (instance == null)
        {
            instance = this;
        }

        else
        {
            Destroy(this);
        }

        if (SpellDataBase.GetSpellDB() == null)
        {
            Debug.Log("Hi");
            spellDB = new SpellDataBase();
        }

        else
        {
            spellDB = SpellDataBase.GetSpellDB();
        }

        minSize           = new Vector2(500, 100);
        guiStyle          = new GUIStyle();
        guiStyle.richText = true;
        spellDB.SetSpellData();
        serObjSpellDB = new SerializedObject(spellDB as object as Object);
        incompProp    = serObjSpellDB.FindProperty("incomplete");
        incompSpells  = new ReorderableList(serObjSpellDB, incompProp, true, true, true, true);
        incompSpells.drawHeaderCallback  = (rect) => EditorGUI.LabelField(new Rect(5, 10, 100, 20), "<size=12><color=orange><b>In Progress</b></color></size>", guiStyle);
        incompSpells.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
        {
            rect.y += 2;
            SerializedProperty spell = incompSpells.serializedProperty.GetArrayElementAtIndex(index);
            EditorGUI.PropertyField(new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight), spell.FindPropertyRelative("spellName"), GUIContent.none);
        };
    }
        public static void Initialize()
        {
            try
            {
                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("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();
                    Perk.FillPerkList();
                }
            }
            catch (Exception ex)
            {
                ModAPI.Log.Write(ex.ToString());
            }
        }
        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());
            }
        }
 public SpellDataBase()
 {
     instance   = this;
     incomplete = new List <Spell>();
     complete   = new List <Spell>();
 }
Exemple #5
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());
            }
        }