Ejemplo n.º 1
0
	public void initFromSmartfox(SFSArray aArray) {
		if(aArray!=null) {
			Debug.Log("Brands: "+aArray.Size()); 
			for(int i = 0;i<aArray.Size();i++) {
				brands.Add(new Brand((SFSObject) aArray.GetSFSObject(i)));
			}
		}

	}
Ejemplo n.º 2
0
    public void OnExtensionResponse(BaseEvent evt)
    {
        try
        {
            string     text       = (string)evt.Params["cmd"];
            ISFSObject iSFSObject = (SFSObject)evt.Params["params"];
            switch (text)
            {
            case "pingAck":
                break;

            case "spawnPlayerAck":
                break;

            case "findRoom":
                Logger.trace("[OnExtensionResponse] found room");
                break;

            case "findRoomAck":
                Logger.trace("[OnExtensionResponse]  room found " + evt.Params.ToString());
                break;

            case "startGame":
                Logger.trace("[OnExtensionResponse]  Receiving Message startGame");
                break;

            case "stopGame":
                Logger.trace("[OnExtensionResponse] Receiving stop game");
                break;

            case "sendEvents":
            {
                SFSArray sFSArray = (SFSArray)iSFSObject.GetSFSArray("events");
                for (int j = 0; j < sFSArray.Size(); j++)
                {
                    SFSObject sFSObject2 = (SFSObject)sFSArray.GetSFSObject(j);
                    int       int3       = sFSObject2.GetInt("playerId");
                    PassEventToPlayerObject(sFSObject2, int3);
                }
                break;
            }

            case "queueTime":
                m_qTime = iSFSObject.GetInt("queueTime");
                break;

            case "sendSummary":
            {
                Debug.Log("\n");
                Debug.Log("\n");
                Debug.Log("\n");
                Debug.Log("### receiving summary");
                Debug.Log("\n");
                Debug.Log("\n");
                Logger.trace("Battle Summary Received");
                Logger.traceError("Summary:" + iSFSObject.GetDump());
                int @int = iSFSObject.GetInt("BanzaiTotal");
                int int2 = iSFSObject.GetInt("AtlasTotal");
                Debug.Log("banzai total: " + @int);
                Debug.Log("atlas total: " + int2);
                GameData.BanzaiHacks = @int;
                GameData.AtlasHacks  = int2;
                string[] keys  = iSFSObject.GetKeys();
                string[] array = keys;
                foreach (string text2 in array)
                {
                    if (!text2.Equals("BanzaiTotal") && !text2.Equals("AtlasTotal"))
                    {
                        SFSObject sFSObject = (SFSObject)iSFSObject.GetSFSObject(text2);
                        Logger.traceError("statData: " + sFSObject.GetDump());
                        int playerId = Convert.ToInt32(text2);
                        GameData.addPlayerStats(playerId, sFSObject);
                    }
                }
                GameObject gameObject = GameObject.Find("Game");
                GamePlay   gamePlay   = gameObject.GetComponent("GamePlay") as GamePlay;
                if (gamePlay != null)
                {
                    gamePlay.BattleSummaryReceived();
                }
                else
                {
                    Debug.Log("cant find gameplay");
                }
                break;
            }

            default:
                Logger.trace("[OnExtensionResponse] unhandled event: " + text);
                break;
            }
        }
        catch (Exception ex)
        {
            Logger.traceError("Exception handling response: " + ex.Message + " >>> " + ex.StackTrace);
        }
    }
Ejemplo n.º 3
0
	public void unpackHorses(SFSArray aArray) {
		for(int i = 0;i<aArray.Size();i++) {
			HorseData h = new HorseData((SFSObject) aArray.GetSFSObject(i));
			horses.Add(h);  
		}
	}