Exemplo n.º 1
0
        void OnGUI()
        {
            // Do autoresizing of GUI layer
            GUIResizer.AutoResize();

            switch (state)
            {
            case 0:
                if (GUI.Button(new Rect(10, 10, 160, 30), "Merge North America", buttonStyle))
                {
                    int countryUSA    = map.GetCountryIndex("United States of America");
                    int countryCanada = map.GetCountryIndex("Canada");
                    map.CountryTransferCountry(countryUSA, countryCanada, true);

                    countryUSA = map.GetCountryIndex("United States of America");
                    int countryMexico = map.GetCountryIndex("Mexico");
                    map.CountryTransferCountry(countryUSA, countryMexico, true);
                    state++;
                }
                break;

            case 1:
                if (GUI.Button(new Rect(10, 10, 160, 30), "Save Current Frontiers", buttonStyle))
                {
                    SaveAllData();
                    state++;
                                        #if UNITY_EDITOR
                    EditorUtility.DisplayDialog("Saved Data", "Data stored in temporary variables. You can now click reset frontiers to simulate a game restart and then Load Saved Data to restore the saved data.", "Ok");
                                        #endif
                }
                break;

            case 2:
                if (GUI.Button(new Rect(10, 10, 160, 30), "Reset Frontiers", buttonStyle))
                {
                    map.ReloadData();
                    map.Redraw();
                    state++;
                }
                break;

            case 3:
                if (GUI.Button(new Rect(10, 10, 160, 30), "Load Saved Data", buttonStyle))
                {
                    LoadAllData();
                    state++;
                                        #if UNITY_EDITOR
                    EditorUtility.DisplayDialog("Data Loaded!", "Data has been loaded from the temporary variables.", "Ok");
                                        #endif
                }
                break;

            case 4:
                if (GUI.Button(new Rect(10, 50, 160, 30), "Reset Frontiers", buttonStyle))
                {
                    map.ReloadData();
                    map.Redraw();
                    state = 0;
                }
                break;
            }
        }