public override void add_choice(string str, Vector2 loc) { List <TextUINode> choices = Choices == null ? new List <TextUINode>() : Choices.ToList(); var text = new TextSprite(); text.SetFont(Tactile.Config.UI_FONT, Global.Content, "White"); text.text = str; var node = new TextUINode("", text, text.text_width); node.loc = loc; choices.Add(node); Choices = new UINodeSet <TextUINode>(choices); Cursor = new UICursor <TextUINode>(Choices); Cursor.hide_when_using_mouse(false); // Resize if needed int width = Font_Data.text_width(str, Tactile.Config.UI_FONT); width = width + (width % 8 == 0 ? 0 : (8 - width % 8)) + 16 + (int)loc.X; if (width > Size.X) { size = new Vector2(width, Size.Y); } }
protected void set_choices(int ox, string str1, string str2) { List <TextUINode> choices = new List <TextUINode>(); var text1 = new TextSprite(); text1.SetFont(Config.CONVO_FONT, Global.Content, "White"); text1.text = str1; var node = new TextUINode("", text1, text1.text_width); node.loc = new Vector2(88 + ox, 32); choices.Add(node); var text2 = new TextSprite(); text2.SetFont(Config.CONVO_FONT, Global.Content, "White"); text2.text = str2; node = new TextUINode("", text2, text2.text_width); node.loc = new Vector2(88 + ox + 40, 32); choices.Add(node); Choices = new UINodeSet <TextUINode>(choices); Cursor = new UICursor <TextUINode>(Choices); Cursor.draw_offset = new Vector2(-16, 0); Cursor.ratio = new int[] { 1, 1 }; Cursor.hide_when_using_mouse(false); Cursor.move_to_target_loc(); }
public static void Clear() { if (UICursor.instance != null && UICursor.instance.mSprite != null) { UICursor.Set(UICursor.instance.mAtlas, UICursor.instance.mSpriteName); } }
public static bool CheckBuildConditionsFast() { var actionBuild = GameMain.data.mainPlayer.controller.actionBuild; bool flag = true; foreach (var buildPreview in actionBuild.buildPreviews) { if (buildPreview.condition != EBuildCondition.Ok) { flag = false; if (!actionBuild.cursorWarning) { actionBuild.cursorWarning = true; actionBuild.cursorText = buildPreview.conditionText; } } } if (flag && actionBuild.waitConfirm) { actionBuild.cursorText = "点击鼠标建造".Translate(); } if (!flag && !VFInput.onGUI) { UICursor.SetCursor(ECursor.Ban); } return(flag); }
private void initMouse() { p_Cursor = new UICursor(this); p_Cursor.Enable(); p_Pan = new UIPan(this, p_Cursor); addUI(p_Pan); }
// Token: 0x060000E3 RID: 227 RVA: 0x00011B94 File Offset: 0x0000FD94 private void UpdateCursor() { if (UIItemSlot.mDraggedItem != null && UIItemSlot.mDraggedItem.baseItem != null) { UICursor.Set(UIItemSlot.mDraggedItem.baseItem.iconAtlas as INGUIAtlas, UIItemSlot.mDraggedItem.baseItem.iconName); return; } UICursor.Clear(); }
protected override void set_nodes(List <CommandUINode> nodes) { Items = new PartialRangeVisibleUINodeSet <CommandUINode>(nodes); Items.CursorMoveSound = System_Sounds.Menu_Move1; Items.WrapVerticalMove = true; UICursor = new UICursor <CommandUINode>(Items); UICursor.draw_offset = new Vector2(-16, 0); UICursor.ratio = new int[] { 1, 1 }; }
void Clear() { Grid_N.SetActiveGrid(null); UICursor.Clear(); mIcontex.enabled = false; mIcontex.mainTexture = null; //mCurrenReq = null; mItemSample = null; }
public bool SelectSetting(bool selected) { switch (Settings.SettingType(this.index)) { case ConfigTypes.Button: // Simply execute the button's operation if (selected) { Settings.ConfirmSetting(this.index, null); RefreshItemValues(); SelectedSettingCursor.force_loc(UICursor.loc); selected = false; } break; case ConfigTypes.SubSettings: if (selected) { OpenSubMenu = true; SelectedSettingCursor.force_loc(UICursor.loc); selected = false; } break; case ConfigTypes.Keyboard: case ConfigTypes.Gamepad: break; default: Items[this.index].set_text_color(selected ? "Green" : "White"); break; } SettingSelected = selected; Greyed_Cursor = SettingSelected; if (SettingSelected) { TempSelectedSettings = (ISettings)Settings.Clone(); TempOriginalSettings = (ISettings)Settings.Clone(); SelectedSettingCursor.force_loc(UICursor.loc); SelectedSettingCursor.set_loc(UICursor.target_loc + new Vector2(VALUE_OFFSET, 0)); SelectedSettingCursor.update(); } else { TempSelectedSettings = null; TempOriginalSettings = null; RefreshCurrentValue(Settings); UICursor.force_loc(SelectedSettingCursor.loc); UICursor.update(); } active = !SettingSelected; return(SettingSelected); }
protected virtual void DoDisplayCursor(bool state) { if (state) { UICursor.Set(this.m_Sprite, this.m_Size, false, this.m_AnimatorState); } else { UICursor.Clear(); } }
// Token: 0x06000035 RID: 53 RVA: 0x0000925C File Offset: 0x0000765C private void UpdateCursor() { if (UIItemSlot.mDraggedItem != null && UIItemSlot.mDraggedItem.baseItem != null) { UICursor.Set(UIItemSlot.mDraggedItem.baseItem.iconAtlas, UIItemSlot.mDraggedItem.baseItem.iconName); } else { UICursor.Clear(); } }
/// <summary> /// Set the cursor to the icon of the item being dragged. /// </summary> void UpdateCursor() { if (mDraggedItem != null && mDraggedItem.baseItem != null) { UICursor.Set(mDraggedItem.baseItem.iconAtlas, mDraggedItem.baseItem.iconName); } else { UICursor.Clear(); } }
// Use this for initialization void Start() { var uiCursor = GetComponent <UICursor>(); if (uiCursor != null) { _uiCursor = uiCursor; } //_isPaused = false; //SetCursorLock(true); }
public void OnClickTowerInfo(TowerSimpleData data) { StopCoroutine("SelectCancel"); StartCoroutine("SelectCancel"); StopCoroutine("CheckUI"); StartCoroutine("CheckUI"); SetSelectedTower(true); spSelectedTower.spriteName = data.TowerType.ToString(); UICursor.Set(atlas, data.TowerType.ToString()); tfSelectedTower.localScale = Vector3.one * 10 / mainCamera.orthographicSize; }
//Detects the release of the mouse button public virtual void OnPointerUp(PointerEventData eventData) { if (!eventData.dragging) { Stack stack = InventoryManager.UI.stack; bool isUnstacking = stack != null && stack.item != null; //Check if we are currently unstacking the item if (isUnstacking && Container.StackOrAdd(this, stack.item)) { stack.item = null; UICursor.Clear(); } if (isUnstacking) { return; } if (Container.useButton.HasFlag((InputButton)Mathf.Clamp(((int)eventData.button * 2), 1, int.MaxValue)) && ObservedItem != null) { if (Container.UseContextMenu) { UIWidgets.ContextMenu menu = InventoryManager.UI.contextMenu; if (menu == null) { return; } menu.Clear(); if (Trigger.currentUsedTrigger != null && Trigger.currentUsedTrigger is VendorTrigger && Container.CanSellItems) { menu.AddMenuItem("Sell", Use); } else if (ObservedItem is UsableItem) { menu.AddMenuItem("Use", Use); } if (ObservedItem.MaxStack > 1 || ObservedItem.MaxStack == 0) { menu.AddMenuItem("Unstack", Unstack); } menu.AddMenuItem("Drop", DropItem); menu.Show(); } else { Use(); } } } }
public void Init(int p_playerId) { if (m_mouseParent) { m_cursor = Instantiate(m_mousePrefab, m_mouseParent.transform); } else { m_cursor = Instantiate(m_mousePrefab); } m_uiCursor = Instantiate(m_uiCursorPrefab, m_uiCanvas.transform).GetComponent <UICursor>(); m_mouse = m_cursor.GetComponent <PlayerMouse>(); m_mouse.useHardwarePointerPosition = false; m_mouse.playerId = p_playerId; m_rewiredPlayer = Rewired.ReInput.players.GetPlayer(p_playerId); if (Player.m_players.Count > 0) { m_player = Player.GetPlayerFromId(p_playerId); } m_mouse.leftButton.actionName = "UIInteract1"; m_mouse.rightButton.actionName = "UIInteract3"; //m_mouse.middleButton.actionName = "UIInteract3"; m_mouse.wheel.yAxis.actionName = "UIWheelY"; float sens = (float)Game.m_options.LoadOptionInt("Sensitivity" + "_" + p_playerId, 100).GetInt() / 50f; float size = (float)Game.m_options.LoadOptionInt("CursorSize" + "_" + p_playerId, 100).GetInt() / 200f; m_mouse.pointerSpeed = sens; m_uiCursor.transform.localScale = new Vector3(size, size, size); List <PlayerMouse> mice = Game.m_rewiredEventSystem.PlayerMice; mice.Add(m_mouse); Game.m_rewiredEventSystem.PlayerMice = mice; ChangeMode(m_useUICoordinatesOnly ? CursorModes.CURSOR : CursorModes.LINE, true); m_mouse.ScreenPositionChangedEvent += OnScreenPositionChanged; m_mouse.screenPosition = new Vector2(Screen.width / 2, Screen.height / 2 + 1); string cursorSprite = Game.m_options.Get("CursorSprite", p_playerId).GetString(); Sprite sprite = SpriteUtils.LoadSpriteFromFile(Application.dataPath + "/Data/Cursors/" + cursorSprite + ".png"); if (sprite != null) { SetCursorImage(sprite); } }
protected override void update_movement(bool input) { int index = this.index; if (num_items() > 0) { (Items as PartialRangeVisibleUINodeSet <CommandUINode>) .Update( input && !Movement_Locked, visible_indexes_range().Enumerate(), -(this.loc + text_draw_vector())); } UICursor.update(); if (Grey_Cursor != null) { Grey_Cursor.force_loc(UICursor.target_loc); } if (index != this.index) { on_index_changed(index); } if (input) { if (Global.Input.touch_pressed(false)) { Vector2 loc = this.loc + Text_Offset + new Vector2(8, 8); if (Global.Input.touch_rectangle( Services.Input.InputStates.Triggered, new Rectangle((int)loc.X, (int)loc.Y, text_area_width, this.rows * 16))) { ManualScroll = true; Console.WriteLine("starting scroll"); } } else { ManualScroll = false; } if (ManualScroll && Global.Input.gesture_triggered(TouchGestures.VerticalDrag)) { ScrollOffset.Y += -Global.Input.verticalDragVector.Y; ScrollOffset.Y = MathHelper.Clamp(ScrollOffset.Y, 0, (this.total_rows - this.rows) * 16); refresh_scroll(); } } }
public void Unstack() { if (item != null) { int amount = Mathf.RoundToInt(spinner.current); item.Stack -= amount; Item newItem = (Item)Instantiate(item); newItem.Stack = amount; item = newItem; UICursor.Set(item.Icon); base.Close(); } }
private void SetIcon(Texture iconTex, string iconString) { if (null != iconTex) { UICursor.Set(mIconAtlas, "Null"); mIcontex.enabled = true; mIcontex.mainTexture = iconTex; mIcontex.transform.localScale = new Vector3(48, 48, 1); } else { UICursor.Set(mIconAtlas, iconString); mIcontex.enabled = false; } }
public static void CheckBuildConditions_Postfix(PlayerAction_Build __instance, ref bool __result) { var ci = cachedInserters; if (CopyInserters.copyEnabled && ci.Count > 0) { __instance.cursorText = __instance.prepareCursorText; __instance.prepareCursorText = string.Empty; __instance.cursorWarning = false; UICursor.SetCursor(ECursor.Default); var flag = true; for (int i = 0; i < __instance.buildPreviews.Count; i++) { BuildPreview buildPreview = __instance.buildPreviews[i]; bool isInserter = buildPreview.desc.isInserter; bool isConnected = buildPreview.inputObjId != 0 || buildPreview.outputObjId != 0; if (isInserter && ( buildPreview.condition == EBuildCondition.TooFar || buildPreview.condition == EBuildCondition.TooClose || buildPreview.condition == EBuildCondition.OutOfReach || // the following fix an incompatibility with AdvanceBuildDestruct where inserter are tagged ascolliding even if they are not (buildPreview.condition == EBuildCondition.Collide && isConnected) )) { buildPreview.condition = EBuildCondition.Ok; } if (buildPreview.condition != EBuildCondition.Ok) { flag = false; if (!__instance.cursorWarning) { __instance.cursorWarning = true; __instance.cursorText = buildPreview.conditionText; } } } if (!flag && !VFInput.onGUI) { UICursor.SetCursor(ECursor.Ban); } __result = flag; } }
private void Awake() { if (_instance != null) { Destroy(this); return; } _instance = this; motionMultiplier = InputManager.Instance.settings.pointerSensitivity; image = GetComponent <Image>(); HandleSubscriptions(true); if (hideOnStart) { SetVisibility(0); } }
public void refresh_nodes() { int active_index = 0; if (UnitNodes != null) { active_index = UnitNodes.ActiveNodeIndex; } var old_cursor = UnitCursor; ActorList = GetActorList(); List <PrepItemsUnitUINode> nodes = new List <PrepItemsUnitUINode>(); // Units for (int index = 0; index < ActorList.Count; index++) { Vector2 loc = new Vector2( (index % this.Columns) * unit_spacing() + 28, (index / this.Columns) * this.RowSize + this.ScissorRectOffset.Y) + unit_offset(); int id = ActorList[index]; nodes.Add(unit_node(id)); nodes[index].loc = loc + new Vector2(this.ScissorRectOffset.X - 8, 0); } UnitNodes = new PartialRangeVisibleUINodeSet <PrepItemsUnitUINode>(nodes); UnitNodes.CursorMoveSound = System_Sounds.Menu_Move1; for (int index = 0; index < ActorList.Count; index++) { refresh_map_sprite(index); refresh_font(index); } UnitCursor = new UICursor <PrepItemsUnitUINode>(UnitNodes); UnitCursor.draw_offset = new Vector2(-12, 0); UnitNodes.set_active_node(UnitNodes[active_index]); UnitCursor.move_to_target_loc(); if (old_cursor != null) { UnitCursor.loc = old_cursor.loc; } UnitNodes.Update(false); }
public static void PlayerAction_BuildCheckBuildConditionsPostfix(PlayerAction_Build __instance, ref bool __result) { var ci = PatchCopyInserters.cachedInserters; if (CopyInserters.copyEnabled && ci.Count > 0) { __instance.cursorText = __instance.prepareCursorText; __instance.prepareCursorText = string.Empty; __instance.cursorWarning = false; UICursor.SetCursor(ECursor.Default); var flag = true; for (int i = 0; i < __instance.buildPreviews.Count; i++) { BuildPreview buildPreview = __instance.buildPreviews[i]; bool isInserter = buildPreview.desc.isInserter; if (isInserter && buildPreview.ignoreCollider && ( buildPreview.condition == EBuildCondition.TooFar || buildPreview.condition == EBuildCondition.TooClose || buildPreview.condition == EBuildCondition.OutOfReach)) { buildPreview.condition = EBuildCondition.Ok; } if (buildPreview.condition != EBuildCondition.Ok) { flag = false; if (!__instance.cursorWarning) { __instance.cursorWarning = true; __instance.cursorText = buildPreview.conditionText; } } } if (!flag && !VFInput.onGUI) { UICursor.SetCursor(ECursor.Ban); } __result = flag; } }
void OnDeleteBtn() { if (m_SplitWnd.gameObject.activeInHierarchy) { return; } if (m_OpType == 2) { m_OpType = 0; UICursor.Clear(); } else { m_OpType = 2; UICursor.Set(mNewUIAtlas, "icodelete"); } m_OpGird = null; }
void OnSplitBtn() { if (m_SplitWnd.activeInHierarchy) { return; } if (m_OpType == 1) { m_OpType = 0; UICursor.Clear(); } else { m_OpType = 1; UICursor.Set(mNewUIAtlas, "icocai"); } m_OpGird = null; }
// Update is called once per frame void Update() { // Page Button //if (m_PageIndex == 2) // m_PageUpBtn.isEnabled = false; //else // m_PageUpBtn.isEnabled = true; //if (m_PageIndex == 0) // m_PageDownBtn.isEnabled = false; //else // m_PageDownBtn.isEnabled = true; if (Input.GetKeyDown(KeyCode.PageUp)) { BtnLeftOnClick(); } if (Input.GetKeyDown(KeyCode.PageDown)) { BtnRightOnClick(); } //lz-2016.10.26 鼠标右键点击取消操作 if ((PeInput.Get(PeInput.LogicFunction.OpenItemMenu) || Input.GetMouseButtonDown(1)) && !m_SplitWnd.activeSelf && m_OpGird == null) { m_OpType = 0; UICursor.Clear(); } switch (m_OpType) { case 1: UICursor.Set(mNewUIAtlas, "icocai"); break; case 2: UICursor.Set(mNewUIAtlas, "icodelete"); break; } }
public WindowCommandSupportViewerActor(int actorId, Vector2 loc) { Rows = LINES; ActorId = actorId; Header = new Support_Command_Components(LINES, this.SupportsRemaining, true); Header.color_override = 0; List <string> strs = GetNames(); initialize(loc, 8 + 16, strs); Window_Img.color_override = 0; Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8); int width = WIDTH - 16; this.text_offset = new Vector2(width - (this.ColumnCount + 1) * 8, 0); set_columns(this.ColumnCount); this.size_offset = new Vector2(width - this.text_area_width, Size_Offset.Y); Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8); initialize_scrollbar(); if (Scrollbar != null) { Scrollbar.loc += new Vector2(4, 0); } // Bar Glow = true; this.glow_width = 16; this.bar_offset = new Vector2(-4, 0); // Cursor UICursor.UpdateTargetLoc(ScrollOffset); UICursor.move_to_target_loc(); PlayerCursor = new Character_Sprite(Global.Content.Load <Texture2D>(@"Graphics/Characters/Cursor")); PlayerCursor.offset = new Vector2(4, 0 - 2); SetUnits(); }
public override void draw_cursor(SpriteBatch sprite_batch) { if (Input.ControlScheme != ControlSchemes.Mouse) { if (Greyed_Cursor) { Grey_Cursor.draw(sprite_batch, -(loc + text_draw_vector())); } } if (!SettingSelected && active && Items.ActiveNode != null) { UICursor.draw(sprite_batch, -(loc + text_draw_vector())); } if (Input.ControlScheme != ControlSchemes.Mouse) { if (SettingSelected) { SelectedSettingCursor.draw(sprite_batch, -(loc + text_draw_vector())); } } }
void OnDestroy () { mInstance = null; }
/// <summary> /// Keep an instance reference so this class can be easily found. /// </summary> void Awake () { mInstance = this; }
void OnDestroy() { instance = null; }
/// <summary> /// Keep an instance reference so this class can be easily found. /// </summary> void Awake() { instance = this; }
private void OnDestroy () { instance = null; }
private void Awake () { instance = this; }
/// <summary> /// Keep an instance reference so this class can be easily found. /// </summary> void Awake () { instance = this; }
/// <summary> /// Keep an instance reference so this class can be easily found. /// </summary> void Awake() { instance = this; Cursor.visible = false; }
void OnDestroy() { instance = null; Cursor.visible = true; }
private void Awake() { UICursor.instance = this; }
private void OnDestroy() { UICursor.instance = null; }