Пример #1
0
        private IEnumerator WaitAndStopDrag()
        {
            yield return(new WaitForFixedUpdate());

            icon        = null;
            draggedPart = null;
        }
Пример #2
0
 public void EnableIcon(int resolution)
 {
     DisableIcon();
     icon = new KIS_IconViewer(
         availablePart, resolution,
         VariantsUtils.GetCurrentPartVariant(availablePart, partNode));
 }
Пример #3
0
 public void DisableIcon()
 {
     if (icon != null)
     {
         icon.Dispose();
         icon = null;
     }
 }
Пример #4
0
 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();
 }
Пример #5
0
 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");
             }
         }
     }
 }
Пример #6
0
 public KIS_IconViewer(Part p, int resolution)
 {
     _iconViewer = new KIS.KIS_IconViewer(p, resolution);
 }
Пример #7
0
 public KIS_IconViewer(object obj)
 {
     _iconViewer = (KIS.KIS_IconViewer)obj;
 }
Пример #8
0
 public void DisableIcon()
 {
     icon = null;
 }
Пример #9
0
 public void DisableIcon()
 {
     icon = null;
 }
Пример #10
0
 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();
 }
Пример #11
0
 private IEnumerator WaitAndStopDrag()
 {
     yield return new WaitForFixedUpdate();
     icon = null;
     draggedPart = null;
 }
Пример #12
0
 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");
             }
         }
     }
 }
Пример #13
0
 public void EnableIcon(int resultion)
 {
     Debug.Log("[OSE] - EnableIcon for " + Part.name);
     Icon = new KIS_IconViewer(Part.partPrefab, resultion);
 }
Пример #14
0
 public void DisableIcon()
 {
     Debug.Log("[OSE] - DisableIcon for " + Part.name);
     Icon = null;
 }
Пример #15
0
 public void EnableIcon(int resultion)
 {
     this.Icon = new KIS_IconViewer(this.Part.partPrefab, resultion);
 }
Пример #16
0
 public void EnableIcon(int resolution)
 {
     icon = new KIS_IconViewer(availablePart.partPrefab, resolution);
 }
Пример #17
0
 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();
 }
Пример #18
0
 public void DisableIcon()
 {
     this.Icon = null;
 }
Пример #19
0
 public void EnableIcon(int resolution)
 {
     icon = new KIS_IconViewer(availablePart.partPrefab, resolution);
 }
Пример #20
0
 public void EnableIcon()
 {
     this.Icon = new KIS_IconViewer(this.Part.partPrefab, 128);
 }
Пример #21
0
        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);
                }
            }
        }
Пример #22
0
 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");
       }
     }
 }