public override void OnKeyDown(KButtonEvent e)
    {
        if (mouseOver && ConsumeMouseScroll && !e.TryConsume(Action.ZoomIn) && !e.TryConsume(Action.ZoomOut))
        {
            goto IL_002e;
        }
        goto IL_002e;
IL_002e:
        if (HasFocus)
        {
            if (e.TryConsume(Action.Escape))
            {
                Game.Instance.Trigger(288942073, null);
                KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
            }
            else
            {
                base.OnKeyDown(e);
                if (!e.Consumed)
                {
                    Action action = e.GetAction();
                    if (action >= Action.BUILD_MENU_START_INTERCEPT)
                    {
                        e.TryConsume(action);
                    }
                }
            }
        }
    }
コード例 #2
0
 public void OnSelectBuilding(GameObject button_go, BuildingDef def)
 {
     if ((UnityEngine.Object)button_go == (UnityEngine.Object)null)
     {
         Debug.Log("Button gameObject is null", base.gameObject);
     }
     else if ((UnityEngine.Object)button_go == (UnityEngine.Object)selectedBuildingGameObject)
     {
         CloseRecipe(true);
     }
     else
     {
         ignoreToolChangeMessages++;
         selectedBuildingGameObject = button_go;
         currentlySelectedToggle    = button_go.GetComponent <KToggle>();
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
         HashedString category = tagCategoryMap[def.Tag];
         if (GetToggleEntryForCategory(category, out ToggleEntry toggleEntry) && toggleEntry.pendingResearchAttentions.Contains(def.Tag))
         {
             toggleEntry.pendingResearchAttentions.Remove(def.Tag);
             button_go.GetComponent <PlanCategoryNotifications>().ToggleAttention(false);
             if (toggleEntry.pendingResearchAttentions.Count == 0)
             {
                 toggleEntry.toggleInfo.toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(false);
             }
         }
         productInfoScreen.ClearProduct(false);
         ToolMenu.Instance.ClearSelection();
         PrebuildTool.Instance.Activate(def, BuildableState(def));
         productInfoScreen.Show(true);
         productInfoScreen.ConfigureScreen(def);
         ignoreToolChangeMessages--;
     }
 }
コード例 #3
0
 private void OnHoverEnterNosweat()
 {
     KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Mouseover", false));
     nosweatButtonSelectionFrame.SetAlpha(1f);
     nosweatButtonHeader.color = new Color(0.7019608f, 0.3647059f, 0.533333361f, 1f);
     descriptionArea.text      = UI.FRONTEND.MODESELECTSCREEN.NOSWEAT_DESC;
 }
コード例 #4
0
 private void ChangePersonalPriority(IPersonalPriorityManager priority_mgr, ChoreGroup chore_group, int delta, bool wrap_around)
 {
     if (priority_mgr.IsChoreGroupDisabled(chore_group))
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false));
     }
     else
     {
         int personalPriority = priority_mgr.GetPersonalPriority(chore_group);
         personalPriority += delta;
         if (wrap_around)
         {
             personalPriority %= 6;
             if (personalPriority < 0)
             {
                 personalPriority += 6;
             }
         }
         personalPriority = Mathf.Clamp(personalPriority, 0, 5);
         priority_mgr.SetPersonalPriority(chore_group, personalPriority);
         if (delta > 0)
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
         }
         else
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false));
         }
     }
 }
コード例 #5
0
 private void OnHoverExitNosweat()
 {
     KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Mouseover", false));
     nosweatButtonSelectionFrame.SetAlpha(0f);
     nosweatButtonHeader.color = new Color(0.309803933f, 0.34117648f, 0.384313732f, 1f);
     descriptionArea.text      = UI.FRONTEND.MODESELECTSCREEN.BLANK_DESC;
 }
コード例 #6
0
 private void ToggleOpen(bool play_sound)
 {
     if (!anyDiscovered)
     {
         if (play_sound)
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false));
         }
     }
     else if (!IsOpen)
     {
         if (play_sound)
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Open", false));
         }
         SetOpen(true);
         elements.LabelText.fontSize    = (float)maximizedFontSize;
         elements.QuantityText.fontSize = (float)maximizedFontSize;
     }
     else
     {
         if (play_sound)
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
         }
         SetOpen(false);
         elements.LabelText.fontSize    = (float)minimizedFontSize;
         elements.QuantityText.fontSize = (float)minimizedFontSize;
     }
 }
    private void OnClickCategory(ToggleInfo toggle_info)
    {
        UserData userData = (UserData)toggle_info.userData;

        PlanScreen.RequirementsState requirementsState = userData.requirementsState;
        if (requirementsState == PlanScreen.RequirementsState.Complete || requirementsState == PlanScreen.RequirementsState.Materials)
        {
            if (selectedCategory != userData.category)
            {
                selectedCategory = userData.category;
                KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
            }
            else
            {
                selectedCategory = HashedString.Invalid;
                ClearSelection();
                KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false));
            }
        }
        else
        {
            selectedCategory = HashedString.Invalid;
            ClearSelection();
            KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false));
        }
        toggle_info.toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(false);
        if (onCategoryClicked != null)
        {
            onCategoryClicked(selectedCategory, userData.depth);
        }
    }
    protected override void OnDragTool(int cell, int distFromOrigin)
    {
        if (path.Count == 0)
        {
            return;
        }
        PathNode pathNode = path[path.Count - 1];

        if (pathNode.cell == cell)
        {
            return;
        }
        placeSound = GlobalAssets.GetSound("Place_building_" + def.AudioSize, false);
        Vector3       pos      = Grid.CellToPos(cell);
        EventInstance instance = SoundEvent.BeginOneShot(placeSound, pos);

        if (path.Count > 1)
        {
            int      num       = cell;
            PathNode pathNode2 = path[path.Count - 2];
            if (num == pathNode2.cell)
            {
                if ((Object)previousCellConnection != (Object)null)
                {
                    previousCellConnection.ConnectedEvent(previousCell);
                    KMonoBehaviour.PlaySound(GlobalAssets.GetSound("OutletDisconnected", false));
                    previousCellConnection = null;
                }
                previousCell = cell;
                CheckForConnection(cell, def.PrefabID, string.Empty, ref previousCellConnection, false);
                PathNode pathNode3 = path[path.Count - 1];
                Object.Destroy(pathNode3.visualizer);
                PathNode pathNode4 = path[path.Count - 1];
                TileVisualizer.RefreshCell(pathNode4.cell, def.TileLayer, def.ReplacementLayer);
                path.RemoveAt(path.Count - 1);
                buildingCount = ((buildingCount != 1) ? (buildingCount - 1) : (buildingCount = 14));
                instance.setParameterValue("tileCount", (float)buildingCount);
                SoundEvent.EndOneShot(instance);
                goto IL_029c;
            }
        }
        if (!path.Exists((PathNode n) => n.cell == cell))
        {
            bool valid = CheckValidPathPiece(cell);
            path.Add(new PathNode
            {
                cell       = cell,
                visualizer = null,
                valid      = valid
            });
            CheckForConnection(cell, def.PrefabID, "OutletConnected", ref previousCellConnection, true);
            buildingCount = buildingCount % 14 + 1;
            instance.setParameterValue("tileCount", (float)buildingCount);
            SoundEvent.EndOneShot(instance);
        }
        goto IL_029c;
IL_029c:
        visualizer.SetActive(path.Count < 2);
        ResourceRemainingDisplayScreen.instance.SetNumberOfPendingConstructions(path.Count);
    }
 private void OnSelectBuilding(BuildingDef def)
 {
     PlanScreen.RequirementsState requirementsState = BuildMenu.Instance.BuildableState(def);
     if (requirementsState == PlanScreen.RequirementsState.Complete || requirementsState == PlanScreen.RequirementsState.Materials)
     {
         if ((UnityEngine.Object)def != (UnityEngine.Object)selectedBuilding)
         {
             selectedBuilding = def;
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
         }
         else
         {
             selectedBuilding = null;
             ClearSelection();
             CloseRecipe(true);
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false));
         }
     }
     else
     {
         selectedBuilding = null;
         ClearSelection();
         CloseRecipe(true);
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false));
     }
     onBuildingSelected(selectedBuilding);
 }
コード例 #10
0
 protected void DisableProceedButton()
 {
     proceedButton.ClearOnClick();
     proceedButton.isInteractable = false;
     proceedButton.onClick       += delegate
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false));
     };
 }
コード例 #11
0
 public override void OnKeyDown(KButtonEvent e)
 {
     if (e.TryConsume(Action.Escape))
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close"));
         Show(show: false);
         e.Consumed = true;
     }
     base.OnKeyDown(e);
 }
コード例 #12
0
    private void UpdateOverlaySounds()
    {
        string soundName = currentModeInfo.mode.GetSoundName();

        if (soundName != string.Empty)
        {
            soundName = GlobalAssets.GetSound(soundName, false);
            KMonoBehaviour.PlaySound(soundName);
        }
    }
コード例 #13
0
 protected override void OnDeactivateTool(InterfaceTool new_tool)
 {
     active = false;
     GridCompositor.Instance.ToggleMajor(false);
     HideToolTip();
     ResourceRemainingDisplayScreen.instance.DeactivateDisplay();
     Object.Destroy(visualizer);
     KMonoBehaviour.PlaySound(GlobalAssets.GetSound(GetDeactivateSound(), false));
     base.OnDeactivateTool(new_tool);
 }
コード例 #14
0
 public void DeselectAndClose()
 {
     KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Back", false));
     SelectTool.Instance.Select(null, false);
     if (!((UnityEngine.Object)target == (UnityEngine.Object)null))
     {
         target = null;
         DeactivateSideContent();
         Show(false);
     }
 }
コード例 #15
0
 public void SetTargetPos(Vector3 pos, float orthographic_size, bool playSound)
 {
     ClearFollowTarget();
     if (playSound && !isTargetPosSet)
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Click_Notification", false));
     }
     isTargetPosSet         = true;
     pos.z                  = -100f;
     targetPos              = pos;
     targetOrthographicSize = orthographic_size;
 }
コード例 #16
0
    private void OnPriorityPress(ChoreGroup chore_group)
    {
        bool   flag = consumer.IsPermittedByUser(chore_group) ? true : false;
        string name = "HUD_Click";

        if (flag)
        {
            name = "HUD_Click_Deselect";
        }
        KMonoBehaviour.PlaySound(GlobalAssets.GetSound(name, false));
        consumer.SetPermittedByUser(chore_group, !consumer.IsPermittedByUser(chore_group));
    }
コード例 #17
0
 public override void OnKeyUp(KButtonEvent e)
 {
     if (selectedCategory.IsValid && PlayerController.Instance.ConsumeIfNotDragging(e, Action.MouseRight))
     {
         OnUIClear(null);
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false));
     }
     if (!e.Consumed)
     {
         base.OnKeyUp(e);
     }
 }
コード例 #18
0
 public void ToggleScreen(ScreenData screenData)
 {
     if (screenData != null)
     {
         if (screenData.toggleInfo == researchInfo && !ResearchAvailable())
         {
             CheckResearch(null);
             CloseActive();
         }
         else if (screenData.toggleInfo == skillsInfo && !SkillsAvailable())
         {
             CheckSkills(null);
             CloseActive();
         }
         else if (screenData.toggleInfo == starmapInfo && !StarmapAvailable())
         {
             CheckStarmap(null);
             CloseActive();
         }
         else if (!screenData.toggleInfo.toggle.gameObject.GetComponentInChildren <ImageToggleState>().IsDisabled)
         {
             if (activeScreen != null)
             {
                 activeScreen.toggleInfo.toggle.isOn = false;
                 activeScreen.toggleInfo.toggle.gameObject.GetComponentInChildren <ImageToggleState>().SetInactive();
             }
             if (activeScreen != screenData)
             {
                 OverlayScreen.Instance.ToggleOverlay(OverlayModes.None.ID, true);
                 if (activeScreen != null)
                 {
                     activeScreen.toggleInfo.toggle.ActivateFlourish(false);
                 }
                 KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Open", false));
                 AudioMixer.instance.Start(AudioMixerSnapshots.Get().MenuOpenMigrated);
                 screenData.toggleInfo.toggle.ActivateFlourish(true);
                 screenData.toggleInfo.toggle.gameObject.GetComponentInChildren <ImageToggleState>().SetActive();
                 CloseActive();
                 activeScreen = screenData;
                 activeScreen.screen.Show(true);
             }
             else
             {
                 activeScreen.screen.Show(false);
                 KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
                 AudioMixer.instance.Stop(AudioMixerSnapshots.Get().MenuOpenMigrated, STOP_MODE.ALLOWFADEOUT);
                 activeScreen.toggleInfo.toggle.ActivateFlourish(false);
                 activeScreen = null;
                 screenData.toggleInfo.toggle.gameObject.GetComponentInChildren <ImageToggleState>().SetInactive();
             }
         }
     }
 }
コード例 #19
0
 public override void OnKeyUp(KButtonEvent e)
 {
     if (PlayerController.Instance.ConsumeIfNotDragging(e, Action.MouseRight))
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close"));
         Show(show: false);
         e.Consumed = true;
     }
     if (!e.Consumed)
     {
         base.OnKeyUp(e);
     }
 }
コード例 #20
0
 public override void OnLeftClickUp(Vector3 cursor_pos)
 {
     cursor_pos -= placementPivot;
     KScreenManager.Instance.SetEventSystemEnabled(true);
     dragAxis = DragAxis.Invalid;
     if (dragging)
     {
         dragging = false;
         Mode mode = GetMode();
         if (areaVisualizerText != Guid.Empty)
         {
             NameDisplayScreen.Instance.RemoveWorldText(areaVisualizerText);
             areaVisualizerText = Guid.Empty;
         }
         if (mode == Mode.Box && (UnityEngine.Object)areaVisualizer != (UnityEngine.Object)null)
         {
             areaVisualizer.SetActive(false);
             Grid.PosToXY(downPos, out int x, out int y);
             int num  = x;
             int num2 = y;
             Grid.PosToXY(cursor_pos, out int x2, out int y2);
             if (x2 < x)
             {
                 Util.Swap(ref x, ref x2);
             }
             if (y2 < y)
             {
                 Util.Swap(ref y, ref y2);
             }
             for (int i = y; i <= y2; i++)
             {
                 for (int j = x; j <= x2; j++)
                 {
                     int cell = Grid.XYToCell(j, i);
                     if (Grid.IsValidCell(cell) && Grid.IsVisible(cell))
                     {
                         int value  = i - num2;
                         int value2 = j - num;
                         value  = Mathf.Abs(value);
                         value2 = Mathf.Abs(value2);
                         OnDragTool(cell, value + value2);
                     }
                 }
             }
             string sound = GlobalAssets.GetSound(GetConfirmSound(), false);
             KMonoBehaviour.PlaySound(sound);
             OnDragComplete(downPos, cursor_pos);
         }
     }
 }
コード例 #21
0
    private void OnRedAlertClick()
    {
        bool flag = !VignetteManager.Instance.Get().IsRedAlertToggledOn();

        VignetteManager.Instance.Get().ToggleRedAlert(flag);
        if (flag)
        {
            KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Open", false));
        }
        else
        {
            KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
        }
    }
コード例 #22
0
    private void ToggleJobEveryone(Button button, ChoreGroup chore_group)
    {
        string name = "HUD_Click_Deselect";

        if (EveryoneToggles[button] != everyoneToggleState.on)
        {
            name = "HUD_Click";
        }
        KMonoBehaviour.PlaySound(GlobalAssets.GetSound(name, false));
        foreach (CrewJobsEntry entryObject in EntryObjects)
        {
            entryObject.consumer.SetPermittedByUser(chore_group, EveryoneToggles[button] != everyoneToggleState.on);
        }
    }
コード例 #23
0
 private void CloseCategoryPanel(bool playSound = true)
 {
     activeCategoryInfo = null;
     if (playSound)
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
     }
     buildingGroupsRoot.GetComponent <ExpandRevealUIContent>().Collapse(delegate
     {
         ClearButtons();
         buildingGroupsRoot.gameObject.SetActive(false);
     });
     PlanCategoryLabel.text = string.Empty;
 }
コード例 #24
0
    private void ToggleAllTasksEveryone()
    {
        string name = "HUD_Click_Deselect";

        if (EveryoneAllTaskToggle.Value != everyoneToggleState.on)
        {
            name = "HUD_Click";
        }
        KMonoBehaviour.PlaySound(GlobalAssets.GetSound(name, false));
        for (int i = 0; i < choreGroups.Count; i++)
        {
            SetJobEveryone(EveryoneAllTaskToggle.Value != everyoneToggleState.on, choreGroups[i]);
        }
    }
 public void CloseRecipe(bool playSound = false)
 {
     if (playSound)
     {
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Deselect", false));
     }
     ToolMenu.Instance.ClearSelection();
     DeactivateBuildTools();
     if ((UnityEngine.Object)PlayerController.Instance.ActiveTool == (UnityEngine.Object)PrebuildTool.Instance)
     {
         SelectTool.Instance.Activate();
     }
     selectedBuilding = null;
     onBuildingSelected(selectedBuilding);
 }
コード例 #26
0
    private void ToggleTasksAll(Button button)
    {
        bool   flag = rowToggleState != CrewJobsScreen.everyoneToggleState.on;
        string name = "HUD_Click_Deselect";

        if (flag)
        {
            name = "HUD_Click";
        }
        KMonoBehaviour.PlaySound(GlobalAssets.GetSound(name, false));
        foreach (ChoreGroup resource in Db.Get().ChoreGroups.resources)
        {
            consumer.SetPermittedByUser(resource, flag);
        }
    }
コード例 #27
0
 public override void OnKeyUp(KButtonEvent e)
 {
     if ((UnityEngine.Object)selectedBuildingGameObject != (UnityEngine.Object)null && PlayerController.Instance.ConsumeIfNotDragging(e, Action.MouseRight))
     {
         CloseRecipe(false);
         KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
     }
     else if (activeCategoryInfo != null && PlayerController.Instance.ConsumeIfNotDragging(e, Action.MouseRight))
     {
         OnUIClear(null);
     }
     if (!e.Consumed)
     {
         base.OnKeyUp(e);
     }
 }
コード例 #28
0
    private void SortByEffectiveness(ChoreGroup chore_group, bool reverse, bool playSound)
    {
        if (playSound)
        {
            KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
        }
        List <CrewJobsEntry> list = new List <CrewJobsEntry>(EntryObjects);

        list.Sort(delegate(CrewJobsEntry a, CrewJobsEntry b)
        {
            float value  = a.Identity.GetAttributes().GetValue(chore_group.attribute.Id);
            float value2 = b.Identity.GetAttributes().GetValue(chore_group.attribute.Id);
            return(value.CompareTo(value2));
        });
        ReorderEntries(list, reverse);
    }
コード例 #29
0
 public override void OnLeftClickDown(Vector3 cursor_pos)
 {
     base.OnLeftClickDown(cursor_pos);
     if ((Object)targetNavigator != (Object)null)
     {
         int mouseCell = DebugHandler.GetMouseCell();
         MoveToLocationMonitor.Instance sMI = targetNavigator.GetSMI <MoveToLocationMonitor.Instance>();
         if (CanMoveTo(mouseCell) && sMI != null)
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click", false));
             sMI.MoveToLocation(mouseCell);
             SelectTool.Instance.Activate();
         }
         else
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Negative", false));
         }
     }
 }
コード例 #30
0
 public override void OnKeyDown(KButtonEvent e)
 {
     if (!e.Consumed && e.TryConsume(Action.Escape) && SelectTool.Instance.enabled)
     {
         if (!canTogglePauseScreen)
         {
             return;
         }
         if (AreSubMenusOpen())
         {
             KMonoBehaviour.PlaySound(GlobalAssets.GetSound("Back", false));
             CloseSubMenus();
             SelectTool.Instance.Select(null, false);
         }
         else if (e.IsAction(Action.Escape))
         {
             if (!SelectTool.Instance.enabled)
             {
                 KMonoBehaviour.PlaySound(GlobalAssets.GetSound("HUD_Click_Close", false));
             }
             if (PlayerController.Instance.IsUsingDefaultTool())
             {
                 if ((Object)SelectTool.Instance.selected != (Object)null)
                 {
                     SelectTool.Instance.Select(null, false);
                 }
                 else
                 {
                     CameraController.Instance.ForcePanningState(false);
                     TogglePauseScreen();
                 }
             }
             else
             {
                 Game.Instance.Trigger(288942073, null);
             }
             ToolMenu.Instance.ClearSelection();
             SelectTool.Instance.Activate();
         }
     }
     base.OnKeyDown(e);
 }