当前位置: 首页>>代码示例>>C#>>正文


C# AC.Recalculate方法代码示例

本文整理汇总了C#中AC.Recalculate方法的典型用法代码示例。如果您正苦于以下问题:C# AC.Recalculate方法的具体用法?C# AC.Recalculate怎么用?C# AC.Recalculate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AC的用法示例。


在下文中一共展示了AC.Recalculate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckScreenSize

 private void CheckScreenSize(AC.Menu menu)
 {
     if (screenSize.x != Screen.width || screenSize.y != Screen.height)
     {
         screenSize = new Vector2 (Screen.width, Screen.height);
         menu.Recalculate ();
     }
 }
开发者ID:mcbodge,项目名称:eidolon,代码行数:8,代码来源:MenuPreview.cs

示例2: OnMenuEnable

        public static void OnMenuEnable(AC.Menu _menu)
        {
            // This function is called whenever a menu is enabled.

            if (_menu.title == "Pause")
            {
                MenuElement saveButton = _menu.GetElementWithName ("SaveButton");

                if (saveButton)
                {
                    saveButton.isVisible = !PlayerMenus.IsSavingLocked ();
                }

                _menu.Recalculate ();
            }
        }
开发者ID:WastNotWantNot,项目名称:WasteNotWantNot,代码行数:16,代码来源:MenuSystem.cs

示例3: ProcessClick

        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick (_menu, _slot, _mouseState);

            if (craftingType == CraftingElementType.Ingredients)
            {
                HandleDefaultClick (_mouseState, _slot);
            }
            else if (craftingType == CraftingElementType.Output)
            {
                ClickOutput (_menu, _mouseState);
            }

            _menu.Recalculate ();
        }
开发者ID:IJkeB,项目名称:Ekster_Final,代码行数:20,代码来源:MenuCrafting.cs

示例4: AddElement

        private void AddElement(string className, AC.Menu _menu)
        {
            Undo.RecordObject (_menu, "Add element");

            List<int> idArray = new List<int>();

            foreach (MenuElement _element in _menu.elements)
            {
                if (_element != null)
                {
                    idArray.Add (_element.ID);
                }
            }
            idArray.Sort ();

            className = "Menu" + className;
            MenuElement newElement = (MenuElement) CreateInstance (className);
            newElement.Declare ();
            newElement.title = className.Substring (4);

            // Update id based on array
            foreach (int _id in idArray.ToArray())
            {
                if (newElement.ID == _id)
                {
                    newElement.ID ++;
                }
            }

            _menu.elements.Add (newElement);
            if (!Application.isPlaying)
            {
                _menu.Recalculate ();
            }
            DeactivateAllElements (_menu);
            newElement.isEditing = true;
            selectedMenuElement = newElement;

            newElement.hideFlags = HideFlags.HideInHierarchy;
            AssetDatabase.AddObjectToAsset (newElement, this);
            AssetDatabase.ImportAsset (AssetDatabase.GetAssetPath (newElement));
            AssetDatabase.SaveAssets ();

            CleanUpAsset ();
        }
开发者ID:mcbodge,项目名称:eidolon,代码行数:45,代码来源:MenuManager.cs

示例5: UpdateMenu


//.........这里部分代码省略.........
                        {
                            menu.TurnOff (true);
                        }
                    }
                }
                catch
                {
                    if (KickStarter.settingsManager.inputMethod != InputMethod.TouchScreen)
                    {
                        Debug.LogWarning ("No '" + menu.toggleKey + "' button exists - please define one in the Input Manager.");
                    }
                }
            }

            else if (menu.appearType == AppearType.OnHotspot)
            {
                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive && !menu.isLocked && KickStarter.runtimeInventory.selectedItem == null)
                {
                    Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot ();
                    if (hotspot != null)
                    {
                        menu.HideInteractions ();

                        if (hotspot.HasContextUse ())
                        {
                            menu.MatchUseInteraction (hotspot.GetFirstUseButton ());
                        }

                        if (hotspot.HasContextLook ())
                        {
                            menu.MatchLookInteraction (hotspot.lookButton);
                        }

                        menu.Recalculate ();
                    }
                }

                if (hotspotLabel != "" && !menu.isLocked && KickStarter.stateHandler.gameState != GameState.Cutscene)
                    //(KickStarter.stateHandler.gameState == GameState.Normal || KickStarter.stateHandler.gameState == GameState.DialogOptions))
                {
                    if (!menu.IsOn ())
                    {
                        menu.TurnOn (true);
                        if (menu.IsUnityUI ())
                        {
                            // Update position before next frame (Unity UI bug)
                            UpdateMenuPosition (menu, invertedMouse);
                        }
                    }
                }
                //else if (KickStarter.stateHandler.gameState == GameState.Paused)
                else if (KickStarter.stateHandler.gameState == GameState.Cutscene)
                {
                    menu.ForceOff ();
                }
                else
                {
                    menu.TurnOff (true);
                }
            }

            else if (menu.appearType == AppearType.OnInteraction)
            {
                if (KickStarter.settingsManager.CanClickOffInteractionMenu ())
                {
                    if (menu.IsEnabled () && (KickStarter.stateHandler.gameState == GameState.Normal || menu.pauseWhenEnabled))
开发者ID:Davetheallthing,项目名称:Space-Walk,代码行数:67,代码来源:PlayerMenus.cs

示例6: UpdateMenuPosition

        /**
         * <summary>Updates a Menu's position.</summary>
         * <param name = "menu">The Menu to reposition</param>
         * <param name = "invertedMouse">The y-inverted mouse position</param>
         */
        public void UpdateMenuPosition(AC.Menu menu, Vector2 invertedMouse)
        {
            if (menu.IsUnityUI ())
            {
                if (Application.isPlaying)
                {
                    Vector2 screenPosition = Vector2.zero;

                    if (menu.uiPositionType == UIPositionType.Manual)
                    {
                        return;
                    }
                    else if (menu.uiPositionType == UIPositionType.FollowCursor)
                    {
                        screenPosition = new Vector2 (invertedMouse.x, Screen.height + 1f - invertedMouse.y);
                        menu.SetCentre (screenPosition);
                    }
                    else if (menu.uiPositionType == UIPositionType.OnHotspot)
                    {
                        if (!menu.IsFadingOut ())
                        {
                            if (mouseOverInventory)
                            {
                                screenPosition = new Vector2 (activeInventoryBoxCentre.x, Screen.height + 1f - activeInventoryBoxCentre.y);
                                menu.SetCentre (screenPosition);
                            }
                            else if (KickStarter.playerInteraction.GetActiveHotspot ())
                            {
                                if (menu.canvas.renderMode == RenderMode.WorldSpace)
                                {
                                    menu.SetCentre (KickStarter.playerInteraction.GetActiveHotspot ().transform.position);
                                }
                                else
                                {
                                    screenPosition = KickStarter.playerInteraction.GetHotspotScreenCentre ();
                                    screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
                                    menu.SetCentre (screenPosition);
                                }
                            }
                        }
                    }
                    else if (menu.uiPositionType == UIPositionType.AboveSpeakingCharacter)
                    {
                        Char speaker = null;
                        if (dupMenus.Contains (menu))
                        {
                            if (menu.speech != null)
                            {
                                speaker = menu.speech.GetSpeakingCharacter ();
                            }
                        }
                        else
                        {
                            speaker = KickStarter.dialog.GetSpeakingCharacter ();
                        }

                        if (speaker != null)
                        {
                            if (menu.canvas.renderMode == RenderMode.WorldSpace)
                            {
                                menu.SetCentre (speaker.transform.position);
                            }
                            else
                            {
                                screenPosition = speaker.GetScreenCentre ();
                                screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
                                menu.SetCentre (screenPosition);
                            }
                        }
                    }
                    else if (menu.uiPositionType == UIPositionType.AbovePlayer)
                    {
                        if (KickStarter.player)
                        {
                            if (menu.canvas.renderMode == RenderMode.WorldSpace)
                            {
                                menu.SetCentre (KickStarter.player.transform.position);
                            }
                            else
                            {
                                screenPosition = KickStarter.player.GetScreenCentre ();
                                screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
                                menu.SetCentre (screenPosition);
                            }
                        }
                    }

                }

                return;
            }

            if (menu.sizeType == AC_SizeType.Automatic && menu.autoSizeEveryFrame)
            {
                menu.Recalculate ();
//.........这里部分代码省略.........
开发者ID:WastNotWantNot,项目名称:WasteNotWantNot,代码行数:101,代码来源:PlayerMenus.cs

示例7: ProcessInventoryBoxClick

        /**
         * <summary>Processes the clicking of an inventory item within a MenuInventoryBox element</summary>
         * <param name = "_menu">The Menu that contains the MenuInventoryBox element</param>
         * <param name = "inventoryBox">The MenuInventoryBox element that was clicked on</param>
         * <param name = "_slot">The index number of the MenuInventoryBox slot that was clicked on</param>
         * <param name = "_mouseState">The state of the mouse when the click occured (Normal, SingleClick, RightClick, DoubleClick, HeldDown, LetGo)</param>
         */
        public void ProcessInventoryBoxClick(AC.Menu _menu, MenuInventoryBox inventoryBox, int _slot, MouseState _mouseState)
        {
            if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Default || inventoryBox.inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected)
            {
                if (KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.playerMenus.IsInteractionMenuOn ())
                {
                    KickStarter.playerMenus.SetInteractionMenus (false);
                    ClickInvItemToInteract ();
                }
                else if (KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.settingsManager.SelectInteractionMethod () == AC.SelectInteractions.CyclingCursorAndClickingHotspot)
                {
                    if (KickStarter.settingsManager.autoCycleWhenInteract && _mouseState == MouseState.SingleClick && (selectedItem == null || KickStarter.settingsManager.cycleInventoryCursors))
                    {
                        int originalIndex = KickStarter.playerInteraction.GetInteractionIndex ();
                        KickStarter.playerInteraction.SetNextInteraction ();
                        KickStarter.playerInteraction.SetInteractionIndex (originalIndex);
                    }

                    if (!KickStarter.settingsManager.cycleInventoryCursors && selectedItem != null)
                    {
                        inventoryBox.HandleDefaultClick (_mouseState, _slot, KickStarter.settingsManager.interactionMethod);
                    }
                    else if (_mouseState != MouseState.RightClick)
                    {
                        KickStarter.playerMenus.SetInteractionMenus (false);
                        ClickInvItemToInteract ();
                    }

                    if (KickStarter.settingsManager.autoCycleWhenInteract && _mouseState == MouseState.SingleClick)
                    {
                        KickStarter.playerInteraction.RestoreInventoryInteraction ();
                    }

                }
                else if (KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Single)
                {
                    inventoryBox.HandleDefaultClick (_mouseState, _slot, AC_InteractionMethod.ContextSensitive);
                }
                else
                {
                    inventoryBox.HandleDefaultClick (_mouseState, _slot, KickStarter.settingsManager.interactionMethod);
                }

                _menu.Recalculate ();
            }
            else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Container)
            {
                inventoryBox.ClickContainer (_mouseState, _slot, KickStarter.playerInput.activeContainer);
                _menu.Recalculate ();
            }
            else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.HotspotBased)
            {
                if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (_menu.GetTargetInvItem () != null)
                    {
                        //Combine (hoverItem, inventoryBox.items [_slot]);
                        Combine (_menu.GetTargetInvItem (), inventoryBox.items [_slot + inventoryBox.GetOffset ()]);
                    }
                    else if (_menu.GetTargetHotspot ())
                    {
                        InvItem _item = inventoryBox.items [_slot + inventoryBox.GetOffset ()];
                        if (_item != null)
                        {
                            //SelectItem (_item, SelectItemMode.Use);
                            _menu.TurnOff (false);
                            KickStarter.playerInteraction.ClickButton (InteractionType.Inventory, -2, _item.id, _menu.GetTargetHotspot ());
                            KickStarter.playerCursor.ResetSelectedCursor ();
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning ("Cannot handle inventory click since there is no active Hotspot.");
                    }
                }
                else
                {
                    ACDebug.LogWarning ("This type of InventoryBox only works with the Choose Hotspot Then Interaction method of interaction.");
                }
            }
        }
开发者ID:WastNotWantNot,项目名称:WasteNotWantNot,代码行数:88,代码来源:RuntimeInventory.cs

示例8: ProcessClick

        /**
         * <summary>Performs what should happen when the element is clicked on.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "_mouseState">The state of the mouse button</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick (_menu, _slot, _mouseState);

            ShowClick ();

            if (buttonClickType == AC_ButtonClickType.TurnOffMenu)
            {
                _menu.TurnOff (doFade);
            }
            else if (buttonClickType == AC_ButtonClickType.Crossfade)
            {
                AC.Menu menuToSwitchTo = PlayerMenus.GetMenuWithName (switchMenuTitle);

                if (menuToSwitchTo != null)
                {
                    KickStarter.playerMenus.CrossFade (menuToSwitchTo);
                }
                else
                {
                    ACDebug.LogWarning ("Cannot find any menu of name '" + switchMenuTitle + "'");
                }
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot)
            {
                if (elementToShift != null)
                {
                    elementToShift.Shift (shiftInventory, shiftAmount);
                    elementToShift.RecalculateSize (_menu.menuSource);
                    _menu.Recalculate ();
                }
                else
                {
                    ACDebug.LogWarning ("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'");
                }
            }
            else if (buttonClickType == AC_ButtonClickType.OffsetJournal)
            {
                MenuJournal journalToShift = (MenuJournal) PlayerMenus.GetElementWithName (_menu.title, inventoryBoxTitle);

                if (journalToShift != null)
                {
                    journalToShift.Shift (shiftInventory, loopJournal, shiftAmount);
                    journalToShift.RecalculateSize (_menu.menuSource);
                    _menu.Recalculate ();
                }
                else
                {
                    ACDebug.LogWarning ("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'");
                }
            }
            else if (buttonClickType == AC_ButtonClickType.RunActionList)
            {
                if (actionList)
                {
                    AdvGame.RunActionListAsset (actionList, parameterID, parameterValue);
                }
            }
            else if (buttonClickType == AC_ButtonClickType.CustomScript)
            {
                MenuSystem.OnElementClick (_menu, this, _slot, (int) _mouseState);
            }
            else if (buttonClickType == AC_ButtonClickType.SimulateInput)
            {
                KickStarter.playerInput.SimulateInput (simulateInput, inputAxis, simulateValue);
            }
        }
开发者ID:mcbodge,项目名称:eidolon,代码行数:78,代码来源:MenuButton.cs


注:本文中的AC.Recalculate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。