This commit is contained in:
Sofia 2017-05-17 01:33:57 +03:00
commit db475d8461
4 changed files with 18 additions and 6 deletions

View File

@ -35,11 +35,11 @@ namespace Cyber.Console {
/// See <see cref="DebugConsole.Println"/>. /// See <see cref="DebugConsole.Println"/>.
/// </summary> /// </summary>
/// <param name="text">Text.</param> /// <param name="text">Text.</param>
public static void Println(string text) { public static void Println(object text) {
if (Console == null) { if (Console == null) {
Debug.Log(text); Debug.Log(text);
} else { } else {
Console.Println(text); Console.Println(text.ToString());
} }
} }
@ -47,11 +47,11 @@ namespace Cyber.Console {
/// See <see cref="DebugConsole.Print"/>. /// See <see cref="DebugConsole.Print"/>.
/// </summary> /// </summary>
/// <param name="text">Text.</param> /// <param name="text">Text.</param>
public static void Print(string text) { public static void Print(object text) {
if (Console == null) { if (Console == null) {
Debug.Log(text); Debug.Log(text);
} else { } else {
Console.Print(text); Console.Print(text.ToString());
} }
} }

View File

@ -187,7 +187,7 @@ namespace Cyber.Controls {
Lerper.LerpTransformPosition(ItemGridCellMeshes[CurrentIndex].transform, new Vector3(), 10f); Lerper.LerpTransformPosition(ItemGridCellMeshes[CurrentIndex].transform, new Vector3(), 10f);
// Switch items // Switch items
Inventory.Drive.SwitchSlots(GrabbedItemIndex, CurrentIndex); Client.Send(PktType.InventoryAction, Inventory.ActionHandler.BuildSlotSwitch(GrabbedItemIndex, CurrentIndex));
// Reset grabbing // Reset grabbing
GrabbedItem = null; GrabbedItem = null;

View File

@ -19,7 +19,12 @@ namespace Cyber.Items {
/// <summary> /// <summary>
/// Use the item in the given slot. /// Use the item in the given slot.
/// </summary> /// </summary>
Use Use,
/// <summary>
/// Switch items between two slots.
/// </summary>
Switch
} }
} }

View File

@ -50,6 +50,10 @@ namespace Cyber.Items {
return new InventoryActionPkt(InventoryAction.Equip, itemIdx); return new InventoryActionPkt(InventoryAction.Equip, itemIdx);
} }
public InventoryActionPkt BuildSlotSwitch(int switchFrom, int switchTo) {
return new InventoryActionPkt(InventoryAction.Switch, new int[]{ switchFrom, switchTo });
}
/// <summary> /// <summary>
/// Handles an <see cref="InventoryActionPkt"/> to handle. Ran on server and client. /// Handles an <see cref="InventoryActionPkt"/> to handle. Ran on server and client.
/// </summary> /// </summary>
@ -76,6 +80,9 @@ namespace Cyber.Items {
return true; return true;
} }
return false; return false;
case InventoryAction.Switch:
Inventory.Drive.SwitchSlots(intList[0], intList[1]);
return true;
} }
return false; return false;
} }