private IEnumerator WaitAndStopDrag() { yield return(new WaitForFixedUpdate()); icon = null; draggedPart = null; }
public void EnableIcon(int resolution) { DisableIcon(); icon = new KIS_IconViewer( availablePart, resolution, VariantsUtils.GetCurrentPartVariant(availablePart, partNode)); }
public void DisableIcon() { if (icon != null) { icon.Dispose(); icon = null; } }
public static void ItemThumbnail(KIS_IconViewer icon) { GUILayout.BeginVertical(); GUILayout.Box("", GUILayout.Width(50), GUILayout.Height(50)); var textureRect = GUILayoutUtility.GetLastRect(); GUI.DrawTexture(textureRect, icon.texture, ScaleMode.ScaleToFit); GUILayout.EndVertical(); }
private void Pickup() { icon = new KIS_IconViewer(draggedPart, draggedIconResolution); KISAddonCursor.StartPartDetection(); grabActive = false; KISAddonCursor.CursorDisable(); if (HighLogic.LoadedSceneIsFlight) { InputLockManager.SetControlLock(ControlTypes.VESSEL_SWITCHING, "KISpickup"); // Disable jetpack mouse control (workaround as SetControlLock didn't have any effect on this) KerbalEVA Keva = FlightGlobals.ActiveVessel.rootPart.GetComponent <KerbalEVA>(); if (Keva) { if (Keva.JetpackDeployed) { Keva.JetpackDeployed = false; jetpackLock = true; KIS_Shared.DebugLog("Jetpack mouse input disabled"); } } } }
public KIS_IconViewer(Part p, int resolution) { _iconViewer = new KIS.KIS_IconViewer(p, resolution); }
public KIS_IconViewer(object obj) { _iconViewer = (KIS.KIS_IconViewer)obj; }
public void DisableIcon() { icon = null; }
void OnDragReleased() { KISAddonCursor.CursorDefault(); if (HighLogic.LoadedSceneIsFlight) { InputLockManager.RemoveControlLock("KISpickup"); // Re-enable jetpack mouse control (workaround as SetControlLock didn't have any effect on this) KerbalEVA Keva = FlightGlobals.ActiveVessel.rootPart.GetComponent<KerbalEVA>(); if (Keva) { if (jetpackLock) { Keva.JetpackDeployed = true; jetpackLock = false; KIS_Shared.DebugLog("Jetpack mouse input re-enabled"); } } } if (hoverInventoryGui()) { // Couroutine to let time to KISModuleInventory to catch the draggedPart StartCoroutine(WaitAndStopDrag()); } else { ModuleKISPartDrag pDrag = null; if (KISAddonCursor.hoveredPart) { if (KISAddonCursor.hoveredPart != draggedPart) { pDrag = KISAddonCursor.hoveredPart.GetComponent<ModuleKISPartDrag>(); } } if (pDrag) { if (draggedItem != null) { draggedItem.DragToPart(KISAddonCursor.hoveredPart); pDrag.OnItemDragged(draggedItem); } else { pDrag.OnPartDragged(draggedPart); } } else { if (HighLogic.LoadedSceneIsEditor) { if (draggedItem != null) { draggedItem.Delete(); } } if (HighLogic.LoadedSceneIsFlight) { if (draggedItem != null) { Drop(draggedItem); } else { movingPart = draggedPart; Drop(movingPart, movingPart); } } } icon = null; draggedPart = null; } KISAddonCursor.StopPartDetection(); }
private IEnumerator WaitAndStopDrag() { yield return new WaitForFixedUpdate(); icon = null; draggedPart = null; }
private void Pickup() { icon = new KIS_IconViewer(draggedPart, draggedIconResolution); KISAddonCursor.StartPartDetection(); grabActive = false; KISAddonCursor.CursorDisable(); if (HighLogic.LoadedSceneIsFlight) { InputLockManager.SetControlLock(ControlTypes.VESSEL_SWITCHING, "KISpickup"); // Disable jetpack mouse control (workaround as SetControlLock didn't have any effect on this) KerbalEVA Keva = FlightGlobals.ActiveVessel.rootPart.GetComponent<KerbalEVA>(); if (Keva) { if (Keva.JetpackDeployed) { Keva.JetpackDeployed = false; jetpackLock = true; KIS_Shared.DebugLog("Jetpack mouse input disabled"); } } } }
public void EnableIcon(int resultion) { Debug.Log("[OSE] - EnableIcon for " + Part.name); Icon = new KIS_IconViewer(Part.partPrefab, resultion); }
public void DisableIcon() { Debug.Log("[OSE] - DisableIcon for " + Part.name); Icon = null; }
public void EnableIcon(int resultion) { this.Icon = new KIS_IconViewer(this.Part.partPrefab, resultion); }
public void EnableIcon(int resolution) { icon = new KIS_IconViewer(availablePart.partPrefab, resolution); }
void OnDragReleased() { KISAddonCursor.CursorDefault(); if (HighLogic.LoadedSceneIsFlight) { InputLockManager.RemoveControlLock("KISpickup"); // Re-enable jetpack mouse control (workaround as SetControlLock didn't have any effect on this) KerbalEVA Keva = FlightGlobals.ActiveVessel.rootPart.GetComponent <KerbalEVA>(); if (Keva) { if (jetpackLock) { Keva.JetpackDeployed = true; jetpackLock = false; KIS_Shared.DebugLog("Jetpack mouse input re-enabled"); } } } if (hoverInventoryGui()) { // Couroutine to let time to KISModuleInventory to catch the draggedPart StartCoroutine(WaitAndStopDrag()); } else { ModuleKISPartDrag pDrag = null; if (KISAddonCursor.hoveredPart) { if (KISAddonCursor.hoveredPart != draggedPart) { pDrag = KISAddonCursor.hoveredPart.GetComponent <ModuleKISPartDrag>(); } } if (pDrag) { if (draggedItem != null) { draggedItem.DragToPart(KISAddonCursor.hoveredPart); pDrag.OnItemDragged(draggedItem); } else { pDrag.OnPartDragged(draggedPart); } } else { if (HighLogic.LoadedSceneIsEditor) { if (draggedItem != null) { draggedItem.Delete(); } } if (HighLogic.LoadedSceneIsFlight) { if (draggedItem != null) { Drop(draggedItem); } else { movingPart = draggedPart; Drop(movingPart, movingPart); } } } icon = null; draggedPart = null; } KISAddonCursor.StopPartDetection(); }
public void DisableIcon() { this.Icon = null; }
public void EnableIcon() { this.Icon = new KIS_IconViewer(this.Part.partPrefab, 128); }
public void ShowInventory() { if (showGui) { // Destroy icons viewer foreach (KeyValuePair<int, KIS_Item> item in items) { item.Value.DisableIcon(); } if (openAnim) { openAnim[openAnimName].speed = -openAnimSpeed; openAnim.Play(openAnimName); } icon = null; showGui = false; if (HighLogic.LoadedSceneIsEditor) { PlaySound(closeSndPath); } else { PlaySound(closeSndPath, false, false); } clickThroughLocked = false; if (HighLogic.LoadedSceneIsFlight) InputLockManager.RemoveControlLock("KISInventoryFlightLock"); if (HighLogic.LoadedSceneIsEditor) InputLockManager.RemoveControlLock("KISInventoryEditorLock"); } else { // Check if inventory can be opened from interior/exterior if (HighLogic.LoadedSceneIsFlight) { if (FlightGlobals.ActiveVessel.isEVA && !externalAccess) { ScreenMessages.PostScreenMessage("This storage is not accessible from the outside !", 4, ScreenMessageStyle.UPPER_CENTER); return; } if (!FlightGlobals.ActiveVessel.isEVA && !internalAccess) { ScreenMessages.PostScreenMessage("This storage is not accessible from the inside !", 4, ScreenMessageStyle.UPPER_CENTER); return; } } // Create icons viewer foreach (KeyValuePair<int, KIS_Item> item in items) { item.Value.EnableIcon(itemIconResolution); } icon = new KIS_IconViewer(this.part, selfIconResolution); if (GetAllOpenInventories().Count == 1 && guiMainWindowPos.x == defaultFlightPos.x && guiMainWindowPos.y == defaultFlightPos.y) { guiMainWindowPos.y += 250; } if (openAnim) { openAnim[openAnimName].speed = openAnimSpeed; openAnim.Play(openAnimName); } showGui = true; if (HighLogic.LoadedSceneIsEditor) { PlaySound(openSndPath); } else { PlaySound(openSndPath, false, false); } } }
private void HandlePickup(PickupMode newPickupMode) { Logger.logInfo("Start pickup in mode {0} from part: {1}", newPickupMode, draggedPart); grabbedPart = null; pickupMode = newPickupMode; cursorMode = CursorMode.Nothing; icon = new KIS_IconViewer(draggedPart, draggedIconResolution); KISAddonCursor.AbortPartDetection(); grabActive = false; KISAddonCursor.CursorDisable(); if (HighLogic.LoadedSceneIsFlight) { InputLockManager.SetControlLock(ControlTypes.VESSEL_SWITCHING, "KISpickup"); // Disable jetpack mouse control (workaround as SetControlLock didn't have any effect on this) KerbalEVA kEva = FlightGlobals.ActiveVessel.rootPart.GetComponent<KerbalEVA>(); if (kEva && kEva.JetpackDeployed) { kEva.JetpackDeployed = false; jetpackLock = true; Logger.logInfo("Jetpack mouse input disabled"); } } }