From 37fe348b2f81c0ae2596268d0e8cc1d95466ba76 Mon Sep 17 00:00:00 2001 From: excitedneon Date: Wed, 17 May 2017 01:19:19 +0300 Subject: [PATCH 1/2] Change Term.Prints' input from a string to an object --- Assets/Scripts/Console/Term.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Console/Term.cs b/Assets/Scripts/Console/Term.cs index 6d9195a..42a5e42 100644 --- a/Assets/Scripts/Console/Term.cs +++ b/Assets/Scripts/Console/Term.cs @@ -35,11 +35,11 @@ namespace Cyber.Console { /// See . /// /// Text. - public static void Println(string text) { + public static void Println(object text) { if (Console == null) { Debug.Log(text); } else { - Console.Println(text); + Console.Println(text.ToString()); } } @@ -47,11 +47,11 @@ namespace Cyber.Console { /// See . /// /// Text. - public static void Print(string text) { + public static void Print(object text) { if (Console == null) { Debug.Log(text); } else { - Console.Print(text); + Console.Print(text.ToString()); } } From 69e6c61bd123cda6463b95ce07446232e83b876c Mon Sep 17 00:00:00 2001 From: excitedneon Date: Wed, 17 May 2017 01:28:12 +0300 Subject: [PATCH 2/2] Sync moving items in the inventory --- Assets/Scripts/Controls/InventoryInterface.cs | 2 +- Assets/Scripts/Items/InventoryAction.cs | 7 ++++++- Assets/Scripts/Items/InventoryActionHandler.cs | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Controls/InventoryInterface.cs b/Assets/Scripts/Controls/InventoryInterface.cs index 2b0cd36..155dbe5 100644 --- a/Assets/Scripts/Controls/InventoryInterface.cs +++ b/Assets/Scripts/Controls/InventoryInterface.cs @@ -187,7 +187,7 @@ namespace Cyber.Controls { Lerper.LerpTransformPosition(ItemGridCellMeshes[CurrentIndex].transform, new Vector3(), 10f); // Switch items - Inventory.Drive.SwitchSlots(GrabbedItemIndex, CurrentIndex); + Client.Send(PktType.InventoryAction, Inventory.ActionHandler.BuildSlotSwitch(GrabbedItemIndex, CurrentIndex)); // Reset grabbing GrabbedItem = null; diff --git a/Assets/Scripts/Items/InventoryAction.cs b/Assets/Scripts/Items/InventoryAction.cs index 97374af..90b06e7 100644 --- a/Assets/Scripts/Items/InventoryAction.cs +++ b/Assets/Scripts/Items/InventoryAction.cs @@ -19,7 +19,12 @@ namespace Cyber.Items { /// /// Use the item in the given slot. /// - Use + Use, + + /// + /// Switch items between two slots. + /// + Switch } } diff --git a/Assets/Scripts/Items/InventoryActionHandler.cs b/Assets/Scripts/Items/InventoryActionHandler.cs index 0648c73..e259f23 100644 --- a/Assets/Scripts/Items/InventoryActionHandler.cs +++ b/Assets/Scripts/Items/InventoryActionHandler.cs @@ -50,6 +50,10 @@ namespace Cyber.Items { return new InventoryActionPkt(InventoryAction.Equip, itemIdx); } + public InventoryActionPkt BuildSlotSwitch(int switchFrom, int switchTo) { + return new InventoryActionPkt(InventoryAction.Switch, new int[]{ switchFrom, switchTo }); + } + /// /// Handles an to handle. Ran on server and client. /// @@ -76,6 +80,9 @@ namespace Cyber.Items { return true; } return false; + case InventoryAction.Switch: + Inventory.Drive.SwitchSlots(intList[0], intList[1]); + return true; } return false; }