Exemplo n.º 1
0
    /**
     * Loads the save data from the disk
     */
    public static void loadData()
    {
        savePath = Application.persistentDataPath + "/save.dat";
        if (File.Exists(savePath))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = new FileStream(savePath, FileMode.Open);
            saveWorld = (SaveWorld)bf.Deserialize(file);
            file.Close();

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    Debug.Log(saveWorld.rotations[i, j]);
                    if (saveWorld.IDs[i, j] != -1)
                    {
                        GameManager.world[i, j] = Instantiate(PrefabManager.IDToGameObject(saveWorld.IDs[i, j]),
                                                              new Vector3(saveWorld.positions[i, j, 0], saveWorld.positions[i, j, 1], 0f),
                                                              Quaternion.Euler(0f, 0f, saveWorld.rotations[i, j])) as GameObject;
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 150, 100, 30), "Load Game"))
     {
         SaveWorld my_save = this.GetComponent <SaveWorld>();
         my_save.load();
     }
 }
Exemplo n.º 3
0
    /**
     * Saves the save data to the disk
     */
    public static void saveData()
    {
        savePath  = Application.persistentDataPath + "/save.dat";
        saveWorld = new SaveWorld();
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = new FileStream(savePath, FileMode.Create);

        bf.Serialize(file, saveWorld);
        file.Close();
    }
Exemplo n.º 4
0
    public void loadGame()
    {
        SaveWorld my_save = this.GetComponent <SaveWorld>();

        my_save.load();
    }
Exemplo n.º 5
0
        public static void Init()
        {
            GameItems.LoadGameItems();

            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands._fileWatcher.Dispose();
                CustomCommands.IsRunning = false;
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Init();
            }

            if (KillMe.IsEnabled)
            {
                KillMe.Init();
            }

            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme._fileWatcher.Dispose();
                Gimme.IsRunning = false;
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Init();
            }

            if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
            {
                HighPingKicker._fileWatcher.Dispose();
                HighPingKicker.IsRunning = false;
            }
            if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
            {
                HighPingKicker.Init();
            }

            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck._fileWatcher.Dispose();
                InventoryCheck.IsRunning = false;
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Init();
            }

            if (TeleportHome.IsEnabled)
            {
                TeleportHome.Init();
            }

            if (TeleportReturn.IsEnabled)
            {
                TeleportReturn.Init();
            }

            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords._fileWatcher.Dispose();
                Badwords.IsRunning = false;
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Init();
            }

            if (SaveWorld.IsRunning && !SaveWorld.IsEnabled)
            {
                SaveWorld.th.Abort();
                SaveWorld.IsRunning = false;
            }
            if (!SaveWorld.IsRunning && SaveWorld.IsEnabled)
            {
                SaveWorld.Init();
            }

            if (InfoTicker.IsRunning && !InfoTicker.IsEnabled)
            {
                InfoTicker.th.Abort();
                InfoTicker.IsRunning = false;
            }
            if (!InfoTicker.IsEnabled && !Motd.IsEnabled && InfoTicker.IsConfigLoaded)
            {
                InfoTicker._fileWatcher.Dispose();
                InfoTicker.IsConfigLoaded = false;
            }
            if (!InfoTicker.IsRunning && InfoTicker.IsEnabled)
            {
                InfoTicker.Init();
            }

            if (!InfoTicker.IsConfigLoaded && Motd.IsEnabled)
            {
                InfoTicker.Init();
            }

            if (ClanManager.IsEnabled)
            {
                ClanData.Init();
            }
        }