Commit e0fa050b authored by mercury233's avatar mercury233 Committed by Unicorn369

add ready button

parent 8069b341
...@@ -529,14 +529,16 @@ public class Room : WindowServantSP ...@@ -529,14 +529,16 @@ public class Room : WindowServantSP
} }
UIHelper.shiftButton(startButton(), true); UIHelper.shiftButton(startButton(), true);
lazyRoom.start.localScale = Vector3.one; lazyRoom.start.localScale = Vector3.one;
lazyRoom.ready.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f + 30f, 0);
lazyRoom.duelist.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f, 0); lazyRoom.duelist.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f, 0);
lazyRoom.observer.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f-30f, 0); lazyRoom.observer.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f, 0);
lazyRoom.start.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f - 30f, 0); lazyRoom.start.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f - 30f, 0);
} }
else else
{ {
UIHelper.shiftButton(startButton(), false); UIHelper.shiftButton(startButton(), false);
lazyRoom.start.localScale = Vector3.zero; lazyRoom.start.localScale = Vector3.zero;
lazyRoom.ready.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f, 0);
lazyRoom.duelist.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f, 0); lazyRoom.duelist.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f, 0);
lazyRoom.observer.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f - 30f, 0); lazyRoom.observer.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f - 30f, 0);
lazyRoom.start.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f - 30f - 30f, 0); lazyRoom.start.localPosition = new Vector3(lazyRoom.duelist.localPosition.x, -94.2f - 30f - 30f - 30f, 0);
...@@ -1020,6 +1022,7 @@ public class Room : WindowServantSP ...@@ -1020,6 +1022,7 @@ public class Room : WindowServantSP
UIHelper.registUIEventTriggerForClick(exitButton().gameObject, listenerForClicked); UIHelper.registUIEventTriggerForClick(exitButton().gameObject, listenerForClicked);
UIHelper.registUIEventTriggerForClick(duelistButton().gameObject, listenerForClicked); UIHelper.registUIEventTriggerForClick(duelistButton().gameObject, listenerForClicked);
UIHelper.registUIEventTriggerForClick(observerButton().gameObject, listenerForClicked); UIHelper.registUIEventTriggerForClick(observerButton().gameObject, listenerForClicked);
UIHelper.registUIEventTriggerForClick(readyButton().gameObject, listenerForClicked);
realize(); realize();
superScrollView.refreshForOneFrame(); superScrollView.refreshForOneFrame();
} }
...@@ -1066,12 +1069,32 @@ public class Room : WindowServantSP ...@@ -1066,12 +1069,32 @@ public class Room : WindowServantSP
return UIHelper.getByName<UIButton>(gameObject, "observer_"); return UIHelper.getByName<UIButton>(gameObject, "observer_");
} }
private UIButton readyButton()
{
return UIHelper.getByName<UIButton>(gameObject, "ready_");
}
void listenerForClicked(GameObject gameObjectListened) void listenerForClicked(GameObject gameObjectListened)
{ {
if (gameObjectListened.name == "exit_") if (gameObjectListened.name == "exit_")
{ {
Program.I().ocgcore.onExit(); Program.I().ocgcore.onExit();
} }
if (gameObjectListened.name == "ready_")
{
if (selftype < realPlayers.Length && realPlayers[selftype] != null)
{
if (realPlayers[selftype].getIfPreped())
{
TcpHelper.CtosMessage_HsNotReady();
}
else
{
TcpHelper.CtosMessage_UpdateDeck(new YGOSharp.Deck("deck/" + Config.Get("deckInUse", "wizard") + ".ydk"));
TcpHelper.CtosMessage_HsReady();
}
}
}
if (gameObjectListened.name == "duelist_") if (gameObjectListened.name == "duelist_")
{ {
TcpHelper.CtosMessage_HsToDuelist(); TcpHelper.CtosMessage_HsToDuelist();
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Collections; using System.Collections;
public class lazyRoom : MonoBehaviour { public class lazyRoom : MonoBehaviour {
public Transform ready;
public Transform duelist; public Transform duelist;
public Transform observer; public Transform observer;
public Transform start; public Transform start;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment