12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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<int, CrystalBaseData> 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<int, ServiceStation> 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());
- }
- }
|