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


C# Menu.Recalculate方法代码示例

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


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

示例1: CheckClick

		private void CheckClick (Menu _menu, MenuElement _element, int _slot, MouseState _mouseState)
		{
			playerInput.mouseState = MouseState.Normal;
			
			if (_mouseState == MouseState.LetGo)
			{
				if (settingsManager.inputMethod == InputMethod.TouchScreen && !settingsManager.offsetTouchCursor && runtimeInventory.selectedItem == null && !(_element is MenuInventoryBox) && !(_element is MenuCrafting))
				{
					_mouseState = MouseState.SingleClick;
				}
				else
				{
					_mouseState = MouseState.Normal;
					return;
				}
			}
			
			if (_mouseState != MouseState.Normal)
			{
				if (_element.clickSound != null && sceneSettings != null)
				{
					sceneSettings.PlayDefaultSound (_element.clickSound, false);
				}
				
				if (_element is MenuDialogList)
				{
					MenuDialogList dialogList = (MenuDialogList) _element;
					dialogList.RunOption (_slot);
				}
				
				else if (_element is MenuSavesList)
				{
					MenuSavesList savesList = (MenuSavesList) _element;
					
					if (savesList.ProcessClick (_slot))
					{
						if (savesList.saveListType == AC_SaveListType.Save)
						{
							_menu.TurnOff (true);
						}
						else if (savesList.saveListType == AC_SaveListType.Load)
						{
							_menu.TurnOff (false);
						}
					}
				}
				
				else if (_element is MenuButton)
				{
					MenuButton button = (MenuButton) _element;
					button.ShowClick ();
					
					if (button.buttonClickType == AC_ButtonClickType.TurnOffMenu)
					{
						_menu.TurnOff (button.doFade);
					}
					else if (button.buttonClickType == AC_ButtonClickType.Crossfade)
					{
						Menu menuToSwitchTo = GetMenuWithName (button.switchMenuTitle);
						
						if (menuToSwitchTo != null)
						{
							CrossFade (menuToSwitchTo);
						}
						else
						{
							Debug.LogWarning ("Cannot find any menu of name '" + button.switchMenuTitle + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.OffsetInventoryOrDialogue)
					{
						MenuElement elementToShift = GetElementWithName (_menu.title, button.inventoryBoxTitle);
						
						if (elementToShift != null)
						{
							elementToShift.Shift (button.shiftInventory, button.shiftAmount);
							elementToShift.RecalculateSize ();
						}
						else
						{
							Debug.LogWarning ("Cannot find '" + button.inventoryBoxTitle + "' inside '" + _menu.title + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.OffsetJournal)
					{
						MenuJournal journalToShift = (MenuJournal) GetElementWithName (_menu.title, button.inventoryBoxTitle);
						
						if (journalToShift != null)
						{
							journalToShift.Shift (button.shiftInventory, button.loopJournal);
							journalToShift.RecalculateSize ();
						}
						else
						{
							Debug.LogWarning ("Cannot find '" + button.inventoryBoxTitle + "' inside '" + _menu.title + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.RunActionList)
					{
						if (button.actionList)
//.........这里部分代码省略.........
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:101,代码来源:PlayerMenus.cs

示例2: UpdateMenu


//.........这里部分代码省略.........
						{
							menu.TurnOff (true);
						}
					}
				}
				catch
				{
					if (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 (settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive && !menu.isLocked && runtimeInventory.selectedItem == null)
				{
					Hotspot hotspot = 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 && (stateHandler.gameState == GameState.Normal || stateHandler.gameState == GameState.DialogOptions))
				{
					menu.TurnOn (true);
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.ForceOff ();
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.OnInteraction)
			{
				if (settingsManager.CanClickOffInteractionMenu ())
				{
					if (menu.IsEnabled () && (stateHandler.gameState == GameState.Normal || menu.pauseWhenEnabled))
					{
						playerInput.interactionMenuIsOn = true;
						
						if (playerInput.mouseState == MouseState.SingleClick && !menu.GetRect ().Contains (invertedMouse))
						{
							playerInput.mouseState = MouseState.Normal;
							playerInput.interactionMenuIsOn = false;
							menu.ForceOff ();
						}
					}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:67,代码来源:PlayerMenus.cs

示例3: CheckScreenSize

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


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