using UnityEngine; using System.Collections; using System.Collections.Generic; using Sfs2X.Entities.Data; public class PoseService : GameRoomService { public const int SEND_SCORE_INTERVAL = 5*1000; protected Dictionary crystalBaseMap; public PoseService (ResponseDelegate callBack):base(callBack) { } override protected void InitGame() { freeTime = 0; } public override void RemoveStation (int stationId) { int numBlue = 0; int numRed = 0; int needRemoveKey = -1; foreach(KeyValuePair kvp in stationDict) { ServiceStation station = kvp.Value; if(station.id == stationId) { needRemoveKey = station.crystalId; } else if(station.teamId == TeamUtil.Team.Blue.GetHashCode()) { numBlue++; } else if(station.teamId == TeamUtil.Team.Red.GetHashCode()) { numRed++; } } if(needRemoveKey != -1) { stationDict.Remove(needRemoveKey); } } public SFSObject GetScoreData(int winTeam) { SFSObject data = new SFSObject(); if(isGameOver) { return data; } data.PutInt("b", blueScore); data.PutInt("r", redScore); data.PutInt("t", GetGameTime()); data.PutInt("f", 0); return data; } override protected void DoTask() { SendBattleInfo(GetScoreData(-1), GetPlayerChangeData(), GetAiTakerChangeData()); } }