コード例 #1
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;
             }
         }
     }
 }
コード例 #2
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();
                }
            }
        }
コード例 #3
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);
                    }
                }
            }
        }