public static void Initialize(IMyInput implementation) { if (Static != null) throw new InvalidOperationException("Input already initialized."); Static = implementation; //Static = isNull ? new MyNullInput() as IMyInput // : new MyDirectXInput(textInputBuffer, nameLookup, defaultGameControls, enableDevKeys) as IMyInput; }
public static void UnloadData() { if (Static != null) { Static.UnloadData(); Static = null; } }
public static void Clean() { Session = null; Entities = null; Players = null; CubeBuilder = null; if (IngameScripting != null) { IngameScripting.Clean(); } IngameScripting = null; TerminalActionsHelper = null; Utilities = null; Parallel = null; Physics = null; Multiplayer = null; PrefabManager = null; Input = null; TerminalControls = null; GridGroups = null; }
public override Point?GetInputPoint() { //null: クリックされてない //clickedNonIMyInputObject: クリックされたがIMyInputでない //otherwise: IMyInputがクリックされた Point?p = null; if (Input.GetMouseButtonUp(0)) { GameObject clickedGameObject = GetClickedGameObject(); if (clickedGameObject != null && clickedGameObject.GetComponent <IMyInput>() != null) { IMyInput clickedPieceScript = clickedGameObject.GetComponent <IMyInput>(); p = clickedPieceScript.GetPoint(); } else { p = clickedNonIMyInputObject; } } return(p); }
public static Vector2 GetCursorPositionDelta(this IMyInput self) { Vector2 renormalizationFactor = Vector2.One; return((new Vector2(self.GetMouseX(), self.GetMouseY())) * renormalizationFactor); }
public static void Clean() { Session = null; Entities = null; Players = null; CubeBuilder = null; if (IngameScripting != null) { IngameScripting.Clean(); } IngameScripting = null; TerminalActionsHelper = null; Utilities = null; Parallel = null; Physics = null; Multiplayer = null; PrefabManager = null; Input = null; TerminalControls = null; }
public override void UpdateAfterSimulation() { if (MyAPIGateway.Session == null) { return; } if (IsClient && MyAPIGateway.Session.Player == null) { return; } if (!init) { Start(); } if (IsClient) { foreach (EquippedToolAction toolAction in equippedTools.ToArray()) { toolAction.Do(config); } equippedTools.Clear(); if (MyAPIGateway.Session.Player.Character != null) { bool toolbar = IsToolbarCharacter(); config.MenuEnabled = toolbar; if (toolbar && IsEnabled()) { IMyInput input = MyAPIGateway.Input; if (equipAll || input.IsNewKeyPressed(config.EquipAllKey)) { foreach (ToolGroup g in config) { g.EquipAny(); } equipAll = false; } else if (input.IsNewKeyPressed(config.UpgradeKey)) { Tool t; ToolGroup tg; if (config.TryGetTool(out t, out tg)) { t.Upgrade(); } } else if (input.IsNewKeyPressed(config.DowngradeKey)) { Tool t; ToolGroup tg; if (config.TryGetTool(out t, out tg)) { t.Downgrade(); } } else { foreach (ToolGroup g in config) { g.HandleInput(); } } } } else { config.MenuEnabled = false; } } }
public static void Clean() { Session = null; Entities = null; Players = null; CubeBuilder = null; TerminalActionsHelper = null; Utilities = null; Parallel = null; Multiplayer = null; PrefabManager = null; Input = null; TerminalControls = null; }