コード例 #1
0
        public void setToSociety(Society soc)
        {
            state = uiState.SOCIETY;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(true);
            uiScrollables.gameObject.SetActive(true);
            uiMidTop.gameObject.SetActive(true);
            uiVoting.gameObject.SetActive(false);
            uIMidLower.gameObject.SetActive(false);
            hexSelector.SetActive(false);
            uiTopLight.gameObject.SetActive(true);

            uiScrollables.viewSocButtonText.text = "View World";

            GraphicalSociety.purge();
            GraphicalMap.purge();

            GraphicalSociety.setup(soc);

            uiLeftPrimary.maskTitle.text = "Neighbor Liking View";
            GraphicalSociety.refreshNeighbor(GraphicalSociety.focus);

            checkData();
        }
コード例 #2
0
        public void bShowUnlanded()
        {
            master.world.audioStore.playClick();

            maskTitle.text = "Unlanded Liking View";
            GraphicalSociety.refreshUnlanded(GraphicalSociety.focus);
        }
コード例 #3
0
        public void save(string filename)
        {
            World world = this;

            world.ui.setToMainMenu();
            GraphicalMap.purge();
            GraphicalSociety.purge();
            world.map.world = null;
コード例 #4
0
        public void bShowNeighbor()
        {
            master.world.audioStore.playClick();

            GraphicalSociety.offX = 0;
            GraphicalSociety.offY = 0;
            maskTitle.text        = "Neighbor Liking View";
            GraphicalSociety.refreshNeighbor(GraphicalSociety.focus);
        }
コード例 #5
0
        public void bShowHierarchy()
        {
            master.world.audioStore.playClick();

            GraphicalSociety.offX = 0;
            GraphicalSociety.offY = 0;
            maskTitle.text        = "Country Hierarchy View";
            GraphicalSociety.refreshHierarchy(null);
        }
コード例 #6
0
        public void bShowDynamic()
        {
            master.world.audioStore.playClick();

            GraphicalSociety.offX = 0;
            GraphicalSociety.offY = 0;
            maskTitle.text        = "Dynamic Relationship View";
            GraphicalSociety.refreshDynamic(null);
        }
コード例 #7
0
        public void OnMouseDown()
        {
            if (inner == null)
            {
                return;
            }

            GraphicalSociety.refresh(inner);
            World.staticMap.world.ui.checkData();
        }
コード例 #8
0
        public void save(string filename)
        {
            try
            {
                World world = this;
                // world.ui.setToMainMenu();
                GraphicalMap.purge();
                GraphicalSociety.purge();
                world.map.world = null;


                //foreach (SocialGroup sg in map.socialGroups)
                //{
                //    if (sg is Society)
                //    {
                //        Society soc = (Society)sg;
                //        soc.voteSession = null;
                //    }
                //}

                fsSerializer _serializer = new fsSerializer();
                fsData       data;
                _serializer.TrySerialize(typeof(Map), map, out data).AssertSuccessWithoutWarnings();

                // emit the data via JSON
                string saveString = fsJsonPrinter.CompressedJson(data);
                World.Log("Save exit point");

                if (File.Exists(filename))
                {
                    World.Log("Overwriting old save: " + filename);
                    File.Delete(filename);
                }
                File.WriteAllLines(filename, new string[] { saveString });

                world.map.world = world;
                staticMap       = map;

                world.prefabStore.popMsg("Game saved as: " + filename);

                //// step 1: parse the JSON data
                //fsData data = fsJsonParser.Parse(serializedState);

                //// step 2: deserialize the data
                //object deserialized = null;
                //_serializer.TryDeserialize(data, type, ref deserialized).AssertSuccessWithoutWarnings();
            }catch (Exception e)
            {
                World.log(e.Message);
                World.log(e.StackTrace);
                prefabStore.popMsg("Failure to save");
                prefabStore.popMsg("Exception: " + e.StackTrace);
            }
        }
コード例 #9
0
        public void scaling()
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                if (EventSystem.current.currentSelectedGameObject != null)
                {
                    return;
                }
            }

            if (world.ui.state == UIMaster.uiState.WORLD)
            {
                if (Input.GetKeyDown("z") || Input.GetAxis("Mouse ScrollWheel") > 0)
                {
                    GraphicalMap.lastMapChange += 1;
                    GraphicalMap.scale          = GraphicalMap.scale * 1.1f;
                    if (GraphicalMap.scale > GraphicalMap.maxScale)
                    {
                        GraphicalMap.scale = GraphicalMap.maxScale;
                    }
                    GraphicalMap.checkData();
                }
                else if (Input.GetKeyDown("x") || Input.GetAxis("Mouse ScrollWheel") < 0)
                {
                    GraphicalMap.lastMapChange += 1;
                    GraphicalMap.scale          = GraphicalMap.scale / 1.1f;
                    if (GraphicalMap.scale < GraphicalMap.minScale)
                    {
                        GraphicalMap.scale = GraphicalMap.minScale;
                    }
                    GraphicalMap.checkData();
                }
            }
            if (world.ui.state == UIMaster.uiState.SOCIETY)
            {
                if (Input.GetKeyDown("z") || Input.GetAxis("Mouse ScrollWheel") > 0)
                {
                    if (GraphicalSociety.focus != null)
                    {
                        GraphicalSociety.zoom += 0.1f;
                        GraphicalSociety.refresh(GraphicalSociety.focus);
                    }
                }
                else if (Input.GetKeyDown("x") || Input.GetAxis("Mouse ScrollWheel") < 0)
                {
                    if (GraphicalSociety.focus != null && GraphicalSociety.zoom > 1)
                    {
                        GraphicalSociety.zoom -= 0.1f;
                        GraphicalSociety.refresh(GraphicalSociety.focus);
                    }
                }
            }
        }
コード例 #10
0
        /*
         * public void bViewSociety()
         * {
         *  if (GraphicalMap.selectedHex == null) { return; }
         *  if (GraphicalMap.selectedHex.owner == null) { return; }
         *  if (GraphicalMap.selectedHex.owner is Society == false) { return; }
         *  if (GraphicalMap.selectedHex.settlement != null)
         *  {
         *      if (GraphicalMap.selectedHex.settlement is Set_City)
         *      {
         *          Set_City city = (Set_City)GraphicalMap.selectedHex.settlement;
         *          if (city.lordSlot != null)
         *          {
         *              setToSociety(city.lordSlot.society, city.lordSlot);
         *              return;
         *          }
         *      }
         *  }
         *  setToSociety((Society)GraphicalMap.selectedHex.owner);
         * }
         */

        /*
         * public void setToSociety(Society soc)
         * {
         *  state = uiState.SOCIETY;
         *  uiWorldRight.gameObject.SetActive(false);
         *  uiHex.gameObject.SetActive(false);
         *  uiMainMenu.gameObject.SetActive(false);
         *  uiSociety.gameObject.SetActive(true);
         *  uiCommon.gameObject.SetActive(true);
         *  uiCity.gameObject.SetActive(false);
         *  GraphicalMap.purge();
         *
         *  GraphicalSociety.centreOn(soc.command.top);
         *  uiSociety.setTo(soc.command.top.person);
         * }
         * public void setToSociety(Society soc, Slot slot)
         * {
         *  state = uiState.SOCIETY;
         *  uiWorldRight.gameObject.SetActive(false);
         *  uiHex.gameObject.SetActive(false);
         *  uiMainMenu.gameObject.SetActive(false);
         *  uiSociety.gameObject.SetActive(true);
         *  uiCommon.gameObject.SetActive(true);
         *  uiCity.gameObject.SetActive(false);
         *  GraphicalMap.purge();
         *
         *  GraphicalSociety.centreOn(slot);
         *  uiSociety.setTo(slot.person);
         * }
         */

        public void setToBackground()
        {
            state = uiState.BACKGROUND;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(false);
            uiScrollables.gameObject.SetActive(false);
            uiMidTop.gameObject.SetActive(false);
            hexSelector.SetActive(false);

            GraphicalMap.purge();
            GraphicalSociety.purge();
        }
コード例 #11
0
 public void load(string filename)
 {
     try
     {
         if (map != null)
         {
             GraphicalMap.purge();
             GraphicalSociety.purge();
             map.world = null;
             map       = null;
         }
         filename = saveFolder + filename;
         string fullFile = File.ReadAllText(filename);
         //string serializedState = fullFile.Substring(fullFile.IndexOf("\n"), fullFile.Length);
         int          startIndex      = fullFile.IndexOf(saveHeader) + saveHeader.Length;
         int          endIndex        = fullFile.Length - startIndex;
         string       serializedState = fullFile.Substring(startIndex, endIndex);
         fsSerializer _serializer     = new fsSerializer();
         fsData       data            = fsJsonParser.Parse(serializedState);
         World.Log("Data parsed");
         object deserialized = null;
         _serializer.TryDeserialize(data, typeof(Map), ref deserialized).AssertSuccessWithoutWarnings();
         World.saveLog.takeLine("Finished deserial");
         map       = (Map)deserialized;
         map.world = this;
         staticMap = map;
         World.self.displayMessages = true;
         GraphicalMap.map           = map;
         //ui.setToMainMenu();
         //GraphicalMap.checkLoaded();
         //GraphicalMap.checkData();
         //graphicalMap.loadArea(0, 0);
         map.decompressFromSave();
         prefabStore.popMsg("Loaded file: " + filename, true);
         World.Log("reached end of loading code");
         // prefabStore.popMsg("Load may well have succeeded.");
     }
     catch (FileLoadException e)
     {
         Debug.Log(e);
         World.log(e.StackTrace);
         prefabStore.popMsg("Exception: " + e.StackTrace, true);
     }
     catch (Exception e2)
     {
         Debug.Log(e2);
         World.log(e2.StackTrace);
         prefabStore.popMsg("Exception: " + e2.StackTrace, true);
     }
 }
コード例 #12
0
        public void setToWorld()
        {
            state = uiState.WORLD;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(true);
            uiScrollables.gameObject.SetActive(true);
            uiMidTop.gameObject.SetActive(true);
            hexSelector.SetActive(true);

            uiScrollables.viewSocButtonText.text = "View Society";

            GraphicalSociety.purge();
        }
コード例 #13
0
        public void setToSociety(Society soc)
        {
            state = uiState.SOCIETY;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(true);
            uiScrollables.gameObject.SetActive(true);
            uiMidTop.gameObject.SetActive(false);
            hexSelector.SetActive(false);

            uiScrollables.viewSocButtonText.text = "View World";

            GraphicalMap.purge();
            GraphicalSociety.setup(soc);
        }
コード例 #14
0
        public void setToMainMenu()
        {
            state = uiState.MAIN_MENU;

            uiMainMenu.gameObject.SetActive(true);
            uiLeftPrimary.gameObject.SetActive(false);
            uiScrollables.gameObject.SetActive(false);
            uiMidTop.gameObject.SetActive(false);
            hexSelector.SetActive(false);

            if (World.staticMap != null)
            {
                GraphicalSociety.purge();
                GraphicalMap.purge();
            }
        }
コード例 #15
0
        public void load(string filename)
        {
            try
            {
                if (map != null)
                {
                    GraphicalMap.purge();
                    GraphicalSociety.purge();
                    map.world = null;
                    map       = null;
                }

                string       serializedState = File.ReadAllText(filename);
                fsSerializer _serializer     = new fsSerializer();
                fsData       data            = fsJsonParser.Parse(serializedState);
                World.Log("Data parsed");
                object deserialized = null;
                _serializer.TryDeserialize(data, typeof(Map), ref deserialized).AssertSuccessWithoutWarnings();
                World.saveLog.takeLine("Finished deserial");
                map              = (Map)deserialized;
                map.world        = this;
                staticMap        = map;
                GraphicalMap.map = map;
                //ui.setToMainMenu();
                //GraphicalMap.checkLoaded();
                //GraphicalMap.checkData();
                //graphicalMap.loadArea(0, 0);
                prefabStore.popMsg("Loaded file: " + filename);
                World.Log("reached end of loading code");
                // prefabStore.popMsg("Load may well have succeeded.");
            }
            catch (FileLoadException e)
            {
                Debug.Log(e);
                World.log(e.StackTrace);
                prefabStore.popMsg("Exception: " + e.StackTrace);
            }
            catch (Exception e2)
            {
                Debug.Log(e2);
                World.log(e2.StackTrace);
                prefabStore.popMsg("Exception: " + e2.StackTrace);
            }
        }
コード例 #16
0
        public void clickOnSociety()
        {
            Vector3       pos  = Input.mousePosition;
            double        dist = 0;
            GraphicalSlot best = null;

            foreach (GraphicalSlot slot in GraphicalSociety.loadedSlots)
            {
                Vector3 slotLoc = world.outerCamera.WorldToScreenPoint(slot.transform.position);
                double  d       = (slotLoc - pos).sqrMagnitude;
                if (best == null || d < dist)
                {
                    dist = d;
                    best = slot;
                }
            }
            //GraphicalSociety.focus = best.inner;
            GraphicalSociety.refresh(best.inner);
        }
コード例 #17
0
        public void setToVoting()
        {
            state = uiState.VOTING;

            uiMainMenu.gameObject.SetActive(false);
            uiLeftPrimary.gameObject.SetActive(false);
            uiScrollables.gameObject.SetActive(false);
            uiMidTop.gameObject.SetActive(false);
            uiVoting.gameObject.SetActive(true);
            uIMidLower.gameObject.SetActive(false);
            hexSelector.SetActive(false);
            uiTopLight.gameObject.SetActive(false);


            if (World.staticMap != null)
            {
                GraphicalSociety.purge();
                GraphicalMap.purge();
            }
        }
コード例 #18
0
 public void bViewEnthralled()
 {
     world.audioStore.playClick();
     if (world.map.overmind.enthralled == null)
     {
         world.prefabStore.popMsg("You have no enthralled currently\n\nYou may enthrall a low-prestige noble (highlighted with flashing purple background) using the \"Enthrall\" power");
         return;
     }
     if (state == uiState.SOCIETY)
     {
         if (GraphicalSociety.focus.society != world.map.overmind.enthralled.society)
         {
             world.prefabStore.popMsg("Your enthralled does not belong to this society");
             return;
         }
         GraphicalSociety.refreshNeighbor(world.map.overmind.enthralled);
     }
     else
     {
         GraphicalSociety.focus = world.map.overmind.enthralled;
         setToSociety(world.map.overmind.enthralled.society);
     }
 }
コード例 #19
0
 public void bViewEnthralled()
 {
     world.audioStore.playClick();
     if (world.map.overmind.enthralled == null)
     {
         world.prefabStore.popMsg("You have no enthralled noble currently\n\nInfiltrate a location using your agents (merchants and vampires excell at this) and enthrall the noble using a Heirophant, or, if playing a political game," +
                                  " you may enthrall a low-prestige noble (highlighted with flashing purple background) using the \"Enthrall\" power");
         return;
     }
     if (state == uiState.SOCIETY)
     {
         if (GraphicalSociety.focus.society != world.map.overmind.enthralled.society)
         {
             world.prefabStore.popMsg("Your enthralled does not belong to this society");
             return;
         }
         GraphicalSociety.refreshNeighbor(world.map.overmind.enthralled);
     }
     else
     {
         GraphicalSociety.focus = world.map.overmind.enthralled;
         setToSociety(world.map.overmind.enthralled.society);
     }
 }
コード例 #20
0
 public void OnMouseDown()
 {
     GraphicalSociety.refresh(inner);
     World.staticMap.world.ui.checkData();
 }
コード例 #21
0
 public void scrollKeys()
 {
     if (world.map.param.option_edgeScroll == 1)
     {
         if (Input.mousePosition.y >= Screen.height - 5)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             -= scrollSpeed;
             if (GraphicalMap.y < 0)
             {
                 GraphicalMap.y = 0;
             }
         }
         else if (Input.mousePosition.y <= 2)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             += scrollSpeed;
             if (GraphicalMap.y > world.map.sy)
             {
                 GraphicalMap.y = world.map.sy;
             }
         }
         if (Input.mousePosition.x <= 0)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             += scrollSpeed;
             if (GraphicalMap.x > world.map.sx)
             {
                 GraphicalMap.x = world.map.sx;
             }
         }
         else if (Input.mousePosition.x >= Screen.width - 5)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             -= scrollSpeed;
             if (GraphicalMap.x < 0)
             {
                 GraphicalMap.x = 0;
             }
         }
     }
     if (UIKeybinds.getKey(UIKeybinds.Action.PAN_UP, true))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offY -= socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             -= scrollSpeed;
             if (GraphicalMap.y < 0)
             {
                 GraphicalMap.y = 0;
             }
         }
     }
     else if (UIKeybinds.getKey(UIKeybinds.Action.PAN_DOWN, true))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offY += socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             += scrollSpeed;
             if (GraphicalMap.y > world.map.sy)
             {
                 GraphicalMap.y = world.map.sy;
             }
         }
     }
     if (UIKeybinds.getKey(UIKeybinds.Action.PAN_LEFT, true))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offX += socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             += scrollSpeed;
             if (GraphicalMap.x > world.map.sx)
             {
                 GraphicalMap.x = world.map.sx;
             }
         }
     }
     else if (UIKeybinds.getKey(UIKeybinds.Action.PAN_RIGHT, true))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offX -= socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             -= scrollSpeed;
             if (GraphicalMap.x < 0)
             {
                 GraphicalMap.x = 0;
             }
         }
     }
 }
コード例 #22
0
        public void scaling()
        {
            //Anyone who wants to read can just pull this value and see if it has changed since they last polled
            if (Input.GetAxis("Mouse ScrollWheel") > 0)
            {
                scrollwheelTracking += 1;
                //World.log("mouse wheel pos");
            }
            else if (Input.GetAxis("Mouse ScrollWheel") < 0)
            {
                scrollwheelTracking -= 1;
                //World.log("mouse wheel neg");
            }

            if (EventSystem.current.IsPointerOverGameObject())
            {
                if (EventSystem.current.currentSelectedGameObject != null)
                {
                    return;
                }
            }

            if (world.ui.state == UIMaster.uiState.WORLD && world.ui.blocker == null)
            {
                if (UIKeybinds.getKey(UIKeybinds.Action.ZOOM_IN) || Input.GetAxis("Mouse ScrollWheel") > 0)
                {
                    GraphicalMap.lastMapChange += 1;
                    GraphicalMap.scale          = GraphicalMap.scale * 1.1f;
                    if (GraphicalMap.scale > GraphicalMap.maxScale)
                    {
                        GraphicalMap.scale = GraphicalMap.maxScale;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.ZOOM_OUT) || Input.GetAxis("Mouse ScrollWheel") < 0)
                {
                    GraphicalMap.lastMapChange += 1;
                    GraphicalMap.scale          = GraphicalMap.scale / 1.1f;
                    if (GraphicalMap.scale < GraphicalMap.minScale)
                    {
                        GraphicalMap.scale = GraphicalMap.minScale;
                    }
                    GraphicalMap.checkData();
                }
            }
            if (world.ui.state == UIMaster.uiState.SOCIETY && world.ui.blocker == null)
            {
                if (UIKeybinds.getKey(UIKeybinds.Action.ZOOM_IN) || Input.GetAxis("Mouse ScrollWheel") > 0)
                {
                    if (GraphicalSociety.focus != null)
                    {
                        GraphicalSociety.zoom += 0.1f;
                        GraphicalSociety.refresh(GraphicalSociety.focus);
                    }
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.ZOOM_OUT) || Input.GetAxis("Mouse ScrollWheel") < 0)
                {
                    if (GraphicalSociety.focus != null && GraphicalSociety.zoom > 1)
                    {
                        GraphicalSociety.zoom -= 0.1f;
                        GraphicalSociety.refresh(GraphicalSociety.focus);
                    }
                }
            }
        }
コード例 #23
0
        public void Update()
        {
            if (world.map != null)
            {
                if (GraphicalMap.selectedHex == null || GraphicalMap.selectedHex.outer == null)
                {
                    hexSelector.SetActive(false);
                }
                else
                {
                    hexSelector.SetActive(true);
                    hexSelector.transform.localScale    = new Vector3(GraphicalMap.scale, GraphicalMap.scale, 1);
                    hexSelector.transform.localPosition = GraphicalMap.getLoc(GraphicalMap.selectedHex) + new Vector3(0, 0, -5);
                }

                if (state == uiState.WORLD)
                {
                    GraphicalMap.tick();
                    //if (GraphicalMap.selectedHex == null)
                    //{
                    //    //uiCity.gameObject.SetActive(false);
                    //    uiScrollables.gameObject.SetActive(true);
                    //}
                    //else
                    //{
                    //   uiScrollables.gameObject.SetActive(true);
                    //}
                }
                else if (state == uiState.SOCIETY)
                {
                    //GraphicalSociety.tick();
                }
            }
            else
            {
                hexSelector.SetActive(false);
            }

            if (state == uiState.WORLD)
            {
                uiLeftPrimary.titleTextDarkener.enabled = GraphicalMap.map.masker.mask != MapMaskManager.maskType.NONE;
                uiLeftPrimary.bodyTextDarkener.enabled  = GraphicalMap.map.masker.mask == MapMaskManager.maskType.LIKING_ME ||
                                                          GraphicalMap.map.masker.mask == MapMaskManager.maskType.LIKING_THEM ||
                                                          GraphicalMap.map.masker.mask == MapMaskManager.maskType.VOTE_EFFECT;
                if (world.map.masker.mask != MapMaskManager.maskType.NONE)
                {
                    uiLeftPrimary.maskTitle.text = GraphicalMap.map.masker.getTitleText();
                    uiLeftPrimary.maskBody.text  = GraphicalMap.map.masker.getBodyText();
                }
                else
                {
                    uiLeftPrimary.maskTitle.text = "";
                    uiLeftPrimary.maskBody.text  = "";
                }

                uiTopLight.gameObject.SetActive(true);
                //uiLeftPrimary.unlandedViewButton.gameObject.SetActive(false);
                uiLeftPrimary.neighborViewButton.gameObject.SetActive(false);
                uiLeftPrimary.hierarchyViewButton.gameObject.SetActive(false);
                //uiLeftPrimary.dynamicViewButton.gameObject.SetActive(false);
                endTurnButton.SetActive(true);
            }
            else if (state == uiState.SOCIETY)
            {
                uiLeftPrimary.maskBody.text             = "";
                uiLeftPrimary.titleTextDarkener.enabled = true;
                uiLeftPrimary.bodyTextDarkener.enabled  = false;

                uiTopLight.gameObject.SetActive(false);
                //uiLeftPrimary.unlandedViewButton.gameObject.SetActive(true);
                uiLeftPrimary.neighborViewButton.gameObject.SetActive(true);
                uiLeftPrimary.hierarchyViewButton.gameObject.SetActive(GraphicalSociety.activeSociety != null && GraphicalSociety.activeSociety.getSovereign() != null);
                //uiLeftPrimary.dynamicViewButton.gameObject.SetActive(true);
                endTurnButton.SetActive(false);

                GraphicalSociety.update();
            }
            else
            {
                uiLeftPrimary.maskTitle.text            = "";
                uiLeftPrimary.maskBody.text             = "";
                uiLeftPrimary.titleTextDarkener.enabled = false;
                uiLeftPrimary.bodyTextDarkener.enabled  = false;

                uiLeftPrimary.unlandedViewButton.gameObject.SetActive(false);
                uiLeftPrimary.neighborViewButton.gameObject.SetActive(false);
                uiLeftPrimary.hierarchyViewButton.gameObject.SetActive(false);
            }

            if (state == uiState.MAIN_MENU)
            {
                uiMainMenu.continueButton.gameObject.SetActive(World.staticMap != null);
            }

            checkBlockerQueue();
        }
コード例 #24
0
        public void save(string filename, bool popMsg = true)
        {
            Map rescueMap = World.staticMap;

            if (checkSaveFolder() == false)
            {
                prefabStore.popMsg("Unable to locate directory " + saveFolder + ". Saving cannot proceed without folder access. Aborting save.", true);
                return;
            }
            if (!hasWritePermission(saveFolder))
            {
                prefabStore.popMsg("Unable to write to directory " + saveFolder + ". Saving cannot proceed without folder access. Aborting save.", true);
                World.autosavePeriod = -1;
                return;
            }

            try
            {
                World world = this;
                // world.ui.setToMainMenu();
                GraphicalMap.purge();
                GraphicalSociety.purge();
                map.compressForSave();
                world.map.world = null;


                //foreach (SocialGroup sg in map.socialGroups)
                //{
                //    if (sg is Society)
                //    {
                //        Society soc = (Society)sg;
                //        soc.voteSession = null;
                //    }
                //}

                fsSerializer _serializer = new fsSerializer();
                fsData       data;
                _serializer.TrySerialize(typeof(Map), map, out data).AssertSuccessWithoutWarnings();

                // emit the data via JSON
                string saveString = fsJsonPrinter.CompressedJson(data);
                World.Log("Save data exit point");

                string catSaveString = "Version;" + World.versionNumber + ";" + World.subversionNumber;
                catSaveString += saveHeader;
                catSaveString += saveString;

                if (File.Exists(filename))
                {
                    World.Log("Overwriting old save: " + filename);
                    File.Delete(filename);
                }
                File.WriteAllLines(filename, new string[] { catSaveString });//Do it all on one line, to avoid faff wrt line endings

                world.map.world = world;
                staticMap       = map;
                map.decompressFromSave();

                if (popMsg)
                {
                    world.prefabStore.popMsg("Game saved as: " + filename, true);
                }

                //// step 1: parse the JSON data
                //fsData data = fsJsonParser.Parse(serializedState);

                //// step 2: deserialize the data
                //object deserialized = null;
                //_serializer.TryDeserialize(data, type, ref deserialized).AssertSuccessWithoutWarnings();
            }
            catch (Exception e)
            {
                World.log(e.Message);
                World.log(e.StackTrace);
                prefabStore.popMsg("Failure to save", true);
                prefabStore.popMsg("Exception: " + e.StackTrace, true);

                map       = rescueMap;
                map.world = this;
                staticMap = map;
            }
        }
コード例 #25
0
 public void OnMouseExit()
 {
     GraphicalSociety.showHover(null);
 }
コード例 #26
0
 public void OnMouseEnter()
 {
     GraphicalSociety.showHover(inner);
 }
コード例 #27
0
 public void scrollKeys()
 {
     if (world.map.param.option_edgeScroll == 1)
     {
         if (Input.mousePosition.y >= Screen.height - 5)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             -= scrollSpeed;
             if (GraphicalMap.y < 0)
             {
                 GraphicalMap.y = 0;
             }
         }
         else if (Input.mousePosition.y <= 2)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             += scrollSpeed;
             if (GraphicalMap.y > world.map.sy)
             {
                 GraphicalMap.y = world.map.sy;
             }
         }
         if (Input.mousePosition.x <= 0)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             += scrollSpeed;
             if (GraphicalMap.x > world.map.sx)
             {
                 GraphicalMap.x = world.map.sx;
             }
         }
         else if (Input.mousePosition.x >= Screen.width - 5)
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             -= scrollSpeed;
             if (GraphicalMap.x < 0)
             {
                 GraphicalMap.x = 0;
             }
         }
     }
     if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offY -= socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             -= scrollSpeed;
             if (GraphicalMap.y < 0)
             {
                 GraphicalMap.y = 0;
             }
         }
     }
     else if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offY += socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.y             += scrollSpeed;
             if (GraphicalMap.y > world.map.sy)
             {
                 GraphicalMap.y = world.map.sy;
             }
         }
     }
     if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offX += socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             += scrollSpeed;
             if (GraphicalMap.x > world.map.sx)
             {
                 GraphicalMap.x = world.map.sx;
             }
         }
     }
     else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
     {
         if (world.ui.state == UIMaster.uiState.SOCIETY)
         {
             if (GraphicalSociety.focus != null)
             {
                 GraphicalSociety.offX -= socScrollSpeed;
                 GraphicalSociety.refreshOffset();
             }
         }
         else
         {
             //GraphicalMap.panStepsToTake = 0;
             GraphicalMap.lastMapChange += 1;
             GraphicalMap.x             -= scrollSpeed;
             if (GraphicalMap.x < 0)
             {
                 GraphicalMap.x = 0;
             }
         }
     }
 }