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


C# Menu.GetRect方法代码示例

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


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

示例1: CheckClicks

		private void CheckClicks (Menu menu)
		{
			if (menu.transitionType == MenuTransition.None && menu.IsFading ())
			{
				// Stop until no longer "fading" so that it appears in right place
				return;
			}
			
			activeInventoryBoxCentre = Vector2.zero;
			
			if (settingsManager.inputMethod == InputMethod.MouseAndKeyboard && menu.GetRect ().Contains (playerInput.GetInvertedMouse ()))
			{
				elementIdentifier = menu.id.ToString ();
			}
			
			foreach (MenuElement element in menu.elements)
			{
				if (element.isVisible)
				{
					for (int i=0; i<element.GetNumSlots (); i++)
					{
						if (SlotIsInteractive (menu, element, i))
						{
							if (playerInput.mouseState != MouseState.Normal && (playerInput.dragState == DragState.None || playerInput.dragState == DragState.Menu))
							{
								if (playerInput.mouseState == MouseState.SingleClick || playerInput.mouseState == MouseState.LetGo || playerInput.mouseState == MouseState.RightClick)// && (!playerInput.interactionMenuIsOn || menu.appearType == AppearType.OnInteraction))
								{
									if (element is MenuInput) {}
									else DeselectInputBox ();
									
									CheckClick (menu, element, i, playerInput.mouseState);
								}
								else if (playerInput.mouseState == MouseState.HeldDown)
								{
									CheckContinuousClick (menu, element, i, playerInput.mouseState);
								}
							}
							else if (playerInteraction.IsDroppingInventory () && CanElementBeDroppedOnto (element))
							{
								DeselectInputBox ();
								CheckClick (menu, element, i, MouseState.SingleClick);
							}
						}
					}
				}
			}
		}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:47,代码来源:PlayerMenus.cs

示例2: UpdateElements

		private void UpdateElements (Menu menu)
		{
			if (menu.transitionType == MenuTransition.None && menu.IsFading ())
			{
				// Stop until no longer "fading" so that it appears in right place
				return;
			}
			
			activeInventoryBoxCentre = Vector2.zero;
			
			if (settingsManager.inputMethod == InputMethod.MouseAndKeyboard && menu.GetRect ().Contains (playerInput.GetInvertedMouse ()))
			{
				elementIdentifier = menu.id.ToString ();
			}
			
			foreach (MenuElement element in menu.elements)
			{
				if (element.isVisible)
				{
					for (int i=0; i<element.GetNumSlots (); i++)
					{
						if (SlotIsInteractive (menu, element, i))
						{
							if ((!playerInput.interactionMenuIsOn || menu.appearType == AppearType.OnInteraction)
							    && (playerInput.dragState == DragState.None || (playerInput.dragState == DragState.Inventory && CanElementBeDroppedOnto (element))))
							{
								if (sceneSettings && element.hoverSound && lastElementIdentifier != (menu.id.ToString () + element.ID.ToString () + i.ToString ()))
								{
									sceneSettings.PlayDefaultSound (element.hoverSound, false);
								}
								
								elementIdentifier = menu.id.ToString () + element.ID.ToString () + i.ToString ();
							}
							
							if (stateHandler.gameState != GameState.Cutscene)
							{
								if (element is MenuInventoryBox)
								{
									if (stateHandler.gameState == GameState.Normal)
									{
										if (settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && settingsManager.inventoryInteractions == InventoryInteractions.Single && runtimeInventory.selectedItem == null)
										{
											playerCursor.ResetSelectedCursor ();
										}
										
										MenuInventoryBox inventoryBox = (MenuInventoryBox) element;
										if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.HostpotBased)
										{
											if (cursorManager.addHotspotPrefix)
											{
												if (runtimeInventory.selectedItem != null)
												{
													hotspotLabel = runtimeInventory.selectedItem.GetLabel ();
												}
												else
												{
													hotspotLabel = playerInteraction.GetLabel ();
												}
												
												if ((runtimeInventory.selectedItem == null && !playerInput.interactionMenuIsOn) || playerInput.interactionMenuIsOn)
												{
													hotspotLabel = cursorManager.hotspotPrefix1.label + " " + inventoryBox.GetLabel (i) + " " + cursorManager.hotspotPrefix2.label + " " + hotspotLabel;
												}
											}
										}
										else
										{
											activeInventoryBoxCentre = menu.GetSlotCentre (inventoryBox, i);
											
											InvItem newHoverItem = inventoryBox.GetItem (i);
											if (oldHoverItem != newHoverItem)
											{
												runtimeInventory.MatchInteractions ();
												playerInteraction.ResetInteractionIndex ();
											}
											runtimeInventory.hoverItem = newHoverItem;
											
											if (!playerInput.interactionMenuIsOn)
											{
												if (inventoryBox.displayType == ConversationDisplayType.IconOnly)
												{
													hotspotLabel = inventoryBox.GetLabel (i);
												}
											}
											else if (runtimeInventory.selectedItem != null)
											{
												hotspotLabel = runtimeInventory.selectedItem.GetLabel ();
											}
										}
									}
								}
								else if (element is MenuCrafting)
								{
									if (stateHandler.gameState == GameState.Normal)
									{
										MenuCrafting crafting = (MenuCrafting) element;
										runtimeInventory.hoverItem = crafting.GetItem (i);
										
										if (runtimeInventory.hoverItem != null)
										{
//.........这里部分代码省略.........
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:101,代码来源:PlayerMenus.cs

示例3: CheckContinuousClick

		private void CheckContinuousClick (Menu _menu, MenuElement _element, int _slot, MouseState _mouseState)
		{
			if (_element is MenuButton)
			{
				MenuButton button = (MenuButton) _element;
				if (button.buttonClickType == AC_ButtonClickType.SimulateInput)
				{
					playerInput.SimulateInput (button.simulateInput, button.inputAxis, button.simulateValue);
				}
				else if (button.buttonClickType == AC_ButtonClickType.CustomScript && button.allowContinuousClick)
				{
					MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
				}
			}
			else if (_element is MenuSlider)
			{
				MenuSlider slider = (MenuSlider) _element;
				if (settingsManager.inputMethod == InputMethod.KeyboardOrController)
				{
					slider.Change ();
				}
				else
				{
					slider.Change (playerInput.GetMousePosition ().x - _menu.GetRect ().x);
				}
				if (slider.sliderType == AC_SliderType.CustomScript)
				{
					MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
				}
			}
		}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:31,代码来源:PlayerMenus.cs

示例4: UpdateMenu

		private void UpdateMenu (Menu menu)
		{
			Vector2 invertedMouse = playerInput.GetInvertedMouse ();
			UpdateMenuPosition (menu, invertedMouse);
			
			menu.HandleTransition ();
			
			if (settingsManager)
			{
				if (settingsManager.inputMethod == InputMethod.KeyboardOrController && menu.IsEnabled () &&
				    ((stateHandler.gameState == GameState.Paused && menu.pauseWhenEnabled) || (stateHandler.gameState == GameState.DialogOptions && menu.appearType == AppearType.DuringConversation)))
				{
					playerInput.selected_option = menu.ControlSelected (playerInput.selected_option);
				}
			}
			else
			{
				Debug.LogWarning ("A settings manager is not present.");
			}
			
			if (menu.appearType == AppearType.Manual)
			{
				if (menu.IsVisible () && !menu.isLocked && menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
				{
					playerInput.mouseOverMenu = true;
				}
			}
			
			else if (menu.appearType == AppearType.DuringGameplay)
			{
				if (stateHandler.gameState == GameState.Normal && !menu.isLocked && menu.IsOff ())
				{
					menu.TurnOn (true);
					
					if (menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
					{
						playerInput.mouseOverMenu = true;
					}
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.TurnOff (true);
				}
				else if (stateHandler.gameState != GameState.Normal && menu.IsOn () && actionListManager.AreActionListsRunning ())
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.MouseOver)
			{
				if (stateHandler.gameState == GameState.Normal && !menu.isLocked && menu.GetRect ().Contains (invertedMouse))
				{
					if (menu.IsOff ())
					{
						menu.TurnOn (true);
					}
					
					if (!menu.ignoreMouseClicks)
					{
						playerInput.mouseOverMenu = true;
					}
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.ForceOff ();
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.OnContainer)
			{
				if (playerInput.activeContainer != null && !menu.isLocked && (stateHandler.gameState == GameState.Normal || (stateHandler.gameState == AC.GameState.Paused && menu.pauseWhenEnabled)))
				{
					if (menu.IsVisible () && menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
					{
						playerInput.mouseOverMenu = true;
					}
					menu.TurnOn (true);
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.DuringConversation)
			{
				if (playerInput.activeConversation != null && stateHandler.gameState == GameState.DialogOptions)
				{
					menu.TurnOn (true);
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.ForceOff ();
				}
				else
//.........这里部分代码省略.........
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:101,代码来源:PlayerMenus.cs

示例5: CheckClick


//.........这里部分代码省略.........
							journalToShift.RecalculateSize ();
						}
						else
						{
							Debug.LogWarning ("Cannot find '" + button.inventoryBoxTitle + "' inside '" + _menu.title + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.RunActionList)
					{
						if (button.actionList)
						{
							AdvGame.RunActionListAsset (button.actionList);
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
					else if (button.buttonClickType == AC_ButtonClickType.SimulateInput)
					{
						playerInput.SimulateInput (button.simulateInput, button.inputAxis, button.simulateValue);
					}
				}
				
				else if (_element is MenuSlider)
				{
					MenuSlider slider = (MenuSlider) _element;
					if (settingsManager.inputMethod == InputMethod.KeyboardOrController)
					{
						slider.Change ();
					}
					else
					{
						slider.Change (playerInput.GetMousePosition ().x - _menu.GetRect ().x);
					}
					if (slider.sliderType == AC_SliderType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
				}
				
				else if (_element is MenuCycle)
				{
					MenuCycle cycle = (MenuCycle) _element;
					cycle.Cycle ();
					
					if (cycle.cycleType == AC_CycleType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
				}
				
				else if (_element is MenuToggle)
				{
					MenuToggle toggle = (MenuToggle) _element;
					toggle.Toggle ();
					
					if (toggle.toggleType == AC_ToggleType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
				}
				
				else if (_element is MenuInventoryBox)
				{
					MenuInventoryBox inventoryBox = (MenuInventoryBox) _element;
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:67,代码来源:PlayerMenus.cs


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