public static void load(Map map)
        {
            try
            {
                if (File.Exists(World.saveFolder + "settings.txt"))
                {
                    string[] data = File.ReadAllLines(World.saveFolder + "settings.txt");

                    string[] split = data[0].Split(',');
                    map.param.option_edgeScroll       = int.Parse(split[0]);
                    map.world.audioStore.effectVolume = int.Parse(split[1]);
                    World.autosavePeriod                 = int.Parse(split[2]);
                    World.autodismissAutosave            = int.Parse(split[3]);
                    map.param.option_useAdvancedGraphics = int.Parse(split[4]);
                    World.musicVolume = int.Parse(split[5]);
                    World.useEvents   = int.Parse(split[6]) == 1?true:false;

                    if (data.Length > 1 && !String.IsNullOrWhiteSpace(data[1]))
                    {
                        UIKeybinds.loadFromString(data[1]);
                    }
                }
            }catch (Exception e)
            {
                //
            }
            hasLoadedOpts = true;
        }
        public static void saveState()
        {
            if (World.checkSaveFolder() == false)
            {
                World.staticMap.world.prefabStore.popMsg("Unable to write to directory " + World.saveFolder + ". Settings will not persist without folder access.", true);
            }

            string stateStr = World.staticMap.param.option_edgeScroll + "," + World.staticMap.world.audioStore.effectVolume + "," + World.autosavePeriod
                              + "," + World.autodismissAutosave + "," + World.staticMap.param.option_useAdvancedGraphics + "," + World.musicVolume + ","
                              + (World.useEvents?"1":"0");

            stateStr += Environment.NewLine + UIKeybinds.saveToString();
            stateStr += Environment.NewLine + World.saveFolder;

            if (File.Exists(World.saveFolder + "settings.txt"))
            {
                File.Delete(World.saveFolder + "settings.txt");
            }
            File.WriteAllText(World.saveFolder + "settings.txt", stateStr);
        }
예제 #3
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;
             }
         }
     }
 }
예제 #4
0
        public void hotkeys()
        {
            if (Input.GetKeyDown(KeyCode.Backspace) && Input.GetKey(KeyCode.LeftShift))
            {
                world.ui.uiMidTop.cheatField.gameObject.SetActive(!world.ui.uiMidTop.cheatField.gameObject.activeSelf);
            }

            if (world.ui.blocker != null)
            {
                return;
            }


            if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.Tab))
            {
            }
            else if (Input.GetKeyDown(KeyCode.LeftControl))
            {
            }
            else if (Input.GetKeyDown(KeyCode.Q))
            {
            }
            else if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (world.ui.state == UIMaster.uiState.VOTING)
                {
                    world.ui.uiVoting.bDismiss();
                }
                world.ui.setToMainMenu();
            }

            if (world.ui.state == UIMaster.uiState.WORLD || world.ui.state == UIMaster.uiState.BACKGROUND)
            {
                if (UIKeybinds.getKey(UIKeybinds.Action.MASK_CLEAR_MASKS))
                {
                    world.map.masker.mask = MapMaskManager.maskType.NONE;
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_NATION))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.NATION)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        World.log("Set to nation");
                        world.map.masker.mask = MapMaskManager.maskType.NATION;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_PROVINCE))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.PROVINCE)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.PROVINCE;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_VOTE_EFFECT))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.VOTE_EFFECT)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.VOTE_EFFECT;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_INFILTRATION))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.INFILTRATION)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.INFILTRATION;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_MY_LIKING))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.LIKING_ME)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.LIKING_ME;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_THEIR_LIKING))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.LIKING_THEM)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.LIKING_THEM;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_AWARENESS))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.AWARENESS)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.AWARENESS;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_MY_SUSPICION))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.SUSPICION)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.SUSPICION;
                    }
                    GraphicalMap.checkData();
                }
                else if (UIKeybinds.getKey(UIKeybinds.Action.MASK_THEIR_SUSPICION))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.SUSPICION_FROM)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.SUSPICION_FROM;
                    }
                    GraphicalMap.checkData();
                }
                else if (Input.GetKeyDown(KeyCode.End))
                {
                    if (world.map.masker.mask == MapMaskManager.maskType.TESTING)
                    {
                        world.map.masker.mask = MapMaskManager.maskType.NONE;
                    }
                    else
                    {
                        world.map.masker.mask = MapMaskManager.maskType.TESTING;
                    }
                    GraphicalMap.checkData();
                }
            }

            if (world.ui.state == UIMaster.uiState.WORLD && world.ui.blocker == null)
            {
                if (Input.GetKeyDown(KeyCode.PageDown))
                {
                    world.bEndTurn();
                }
            }
        }
예제 #5
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);
                    }
                }
            }
        }