Exemplo n.º 1
0
    public void settings()
    {
        List <string> s = new List <string>();

        s.Add("Ok");
        WindowUI wui = new WindowUI(WindowImage.INFO, WindowType.OK, s, "Coming Soon", "This feature is coming soon!", true, 7, ExitDefault.CLOSEOPERATION);

        wui.Display();
    }
Exemplo n.º 2
0
    public void renameWorld()
    {
        List <string> s = new List <string>();

        s.Add("Ok");
        s.Add("World Name");
        WindowUI wui = new WindowUI(WindowImage.INFO, WindowType.INPUTFIELD, s, "Rename World", "Please enter in the new name:", false, 8, ExitDefault.CLOSEOPERATION);

        wui.Display();
    }
Exemplo n.º 3
0
    /**
     * Save the game
     */
    public void saveGame()
    {
        sal.Save(World.name);
        menuPanel.SetActive(false);
        overlay.SetActive(true);
        List <string> s = new List <string>();

        s.Add("Ok");
        WindowUI wui = new WindowUI(WindowImage.INFO, WindowType.OK, s, "Game Saved", "The game has been saved!", false, 10, ExitDefault.CLOSEOPERATION);

        wui.Display();
    }
Exemplo n.º 4
0
    public void mainMenu()
    {
        //sal.Save(World.name); (unused)
        //Debug.Log(World.name); (unused)
        List <string> s = new List <string>();

        s.Add("Yes");
        s.Add("No");
        WindowUI wui = new WindowUI(WindowImage.INFO, WindowType.YES_NO, s, "Main Menu", "Are you sure you want to go back to the main menu? (Your progress will not be saved)", true, 3, ExitDefault.CLOSEOPERATION);

        wui.Display();
    }
Exemplo n.º 5
0
    /*
     * If the player clicks exit game.
     */
    public void exitGame()
    {
        //sal.Save(World.name);
        List <string> s = new List <string>();

        s.Add("Yes");
        s.Add("No");
        WindowUI wui = new WindowUI(WindowImage.INFO, WindowType.YES_NO, s, "Exit The Game", "Are you sure you want to exit the game? (Any unsaved progress will not be saved.)", false, 2, ExitDefault.CLOSEOPERATION);

        wui.SetBackgroundActive(true);
        wui.Display();
        menuPanel.SetActive(false);
        overlay.SetActive(true);
    }
Exemplo n.º 6
0
    void forLoop(List <SerObject> ls)
    {
        foreach (SerObject ob in ls)
        {
            GameObject obj = (GameObject)Instantiate(Resources.Load(ob.name), new Vector3(-900, 0, -900), Quaternion.identity);
            obj.transform.position    = new Vector3(ob.x, ob.y, ob.z);
            obj.transform.eulerAngles = new Vector3(ob.rotX, ob.rotY, ob.rotZ);
            obj.transform.localScale  = new Vector3(ob.scalX, ob.scalY, ob.scalZ);
            obj.layer = 10;
            obj.GetComponent <BoxCollider>().enabled = true;
            SerBuildableStats bs = ob.sbs;
            if (bs != null)                                                                  //TODO remove hard code.
            {
                obj.GetComponent <BuildableStats>().transparency = (int)ob.sbs.transparency; // Loads in the build stats data.
            }
            else
            {
                List <string> s = new List <string>();
                s.Add("Continue");
                s.Add("Exit to Main Menu");
                WindowUI wui = new WindowUI(WindowImage.WARNING, WindowType.YES_NO, s, "Older Version", "It looks like you are loading this world from an older version of the game. The objects have been updated to the new format. Would you like to continue?", false, 4, ExitDefault.CLOSEOPERATION);
                wui.Display();
            }
            SerObjectProperties serializedObjectProperties = ob.objProperties;
            if (serializedObjectProperties != null)
            {
                // Note: Only one ObjectProperties can exist on an object.
                bool proper = obj.GetComponent <ObjectProperties>().SetupSerialziedData(serializedObjectProperties);
                if (!proper)
                {
                    List <string> s = new List <string>();
                    s.Add("Continue");
                    s.Add("Exit to Main Menu");
                    WindowUI wui = new WindowUI(WindowImage.WARNING, WindowType.YES_NO, s, "Older Version", "It looks like you are loading this world from an older version of the game. The objects have been updated to the new format. Would you like to continue?", false, 4, ExitDefault.CLOSEOPERATION);
                    wui.Display();
                }
            }


            World.objects.Add(obj, ob.name);
        }
    }
Exemplo n.º 7
0
    public void openInFolder()
    {
        if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + manage.options[manage.value].text + ".dat"))
            {
                p.StartInfo = new System.Diagnostics.ProcessStartInfo("explorer.exe", "/select," + (Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + manage.options[manage.value].text + ".dat").Replace(@"/", @"\"));
            }
            else
            {
                p.StartInfo = new System.Diagnostics.ProcessStartInfo("explorer.exe", "/select," + Application.persistentDataPath + Path.DirectorySeparatorChar + "saves");
            }
            p.Start();
        }
        else if (Application.platform == RuntimePlatform.OSXPlayer)
        {
            bool   openInsidesOfFolder;
            string macPath;
            if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + manage.options[manage.value].text + ".dat"))
            {
                openInsidesOfFolder = false;
                macPath             = Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + manage.options[manage.value].text + ".dat";
            }
            else
            {
                openInsidesOfFolder = true;
                macPath             = Application.persistentDataPath + Path.DirectorySeparatorChar + "saves";
            }

            string arguments = (openInsidesOfFolder ? "" : "-R ") + macPath;
            System.Diagnostics.Process.Start("open", arguments);
        }
        else
        {
            List <string> s = new List <string>();
            s.Add("Ok");
            WindowUI wui = new WindowUI(WindowImage.ERROR, WindowType.OK, s, "File Browser", "This game does not support your operating system!", false, 6, ExitDefault.CLOSEOPERATION);
            wui.Display();
        }
    }
Exemplo n.º 8
0
 public void rWorld(string s)
 {
     if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + s + ".dat"))
     {
         List <string> st = new List <string>();
         st.Add("ok");
         WindowUI wui = new WindowUI(WindowImage.WARNING, WindowType.OK, st, "World Rename Error", "The world name already exists.", true, 12, ExitDefault.CLOSEOPERATION);
         wui.Display();
         return;
     }
     if (manage.options[manage.value].text == s)
     {
         List <string> st = new List <string>();
         st.Add("Ok");
         WindowUI wui = new WindowUI(WindowImage.ERROR, WindowType.OK, st, "World Rename", "You must rename to world to something else!", false, 9, ExitDefault.CLOSEOPERATION);
         wui.Display();
     }
     else
     {
         File.Move(Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + manage.options[manage.value].text + ".dat", Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + s + ".dat");
     }
     dropdownManager.mangeWrolds();
 }
Exemplo n.º 9
0
    public void Load(string name)
    {
        if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "saves" + Path.DirectorySeparatorChar + name + ".dat"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/saves/" + name + ".dat", FileMode.Open);
            try
            {
                try
                {
                    data = (SerializedSaveData)bf.Deserialize(file);
                }
                catch (InvalidCastException ex)
                {
                    savedata oldData = null;

                    // If this is an old save file, convert it.
                    oldData   = (savedata)bf.Deserialize(file);
                    data      = ConvertFromOldData(oldData);
                    isOldFile = true;
                }
            }
            catch (SerializationException exs)
            {
                List <string> s = new List <string>();
                s.Add("Back to Main Menu");
                WindowUI wui = new WindowUI(WindowImage.ERROR, WindowType.OK, s, "Unable to Load World", "It looks like the world could not be loaded. This could be due to a corruption or old version.", false, 22, ExitDefault.NONE);
                wui.SetBackgroundActive(true);
                wui.Display();
            }

            CopyLoadData();

            file.Close();
        }//
    }