StationHandler.cs 709 B

123456789101112131415161718192021222324252627282930313233
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Sfs2X.Entities.Data;
  5. public class StationHandler : BAHandler
  6. {
  7. public StationHandler(BARoom room):base(room){}
  8. public override void HandleRequest (BAServer server, ISFSObject msg, int sender, int timeStamp)
  9. {
  10. ISFSObject data = msg.GetSFSObject (Message.LABEL_DATA);
  11. if(data.ContainsKey("i"))
  12. {
  13. server.RoomHandleResponse (msg);
  14. }
  15. else if(room.IsHost())
  16. {
  17. int crystalIndex = data.GetInt("c");
  18. int teamId = data.GetInt("t");
  19. BAStation station = room.AttempAddStation (crystalIndex, teamId);
  20. if(station != null)
  21. {
  22. data.PutInt ("i", station.id);
  23. server.Send (msg);
  24. }
  25. }
  26. }
  27. }