Beispiel #1
0
    private void BattleResCallback(SocketIOEvent e)
    {
        Debug.Log("[O]battle_res: " + e.ToString());
        string aname = e.data.GetField("aname").str;
        string dname = e.data.GetField("dname").str;
        List <BattleCardModifier> amods = JSONListToBCMList(e.data.GetField("amods").list);
        List <BattleCardModifier> dmods = JSONListToBCMList(e.data.GetField("dmods").list);
        int         aoap     = (int)e.data.GetField("aoap").n;
        int         doap     = (int)e.data.GetField("doap").n;
        List <Card> abattle  = JSONListToCardList(e.data.GetField("abattle").list);
        List <Card> bbattle  = JSONListToCardList(e.data.GetField("bbattle").list);
        List <Card> akilled  = JSONListToCardList(e.data.GetField("akilled").list);
        List <Card> atouched = JSONListToCardList(e.data.GetField("atouched").list);
        List <Card> dkilled  = JSONListToCardList(e.data.GetField("dkilled").list);
        List <Card> dtouched = JSONListToCardList(e.data.GetField("dtouched").list);
        int         ahit     = (int)e.data.GetField("ahit").n;
        int         dhit     = (int)e.data.GetField("dhit").n;
        int         aaap     = (int)e.data.GetField("aaap").n;
        int         daap     = (int)e.data.GetField("daap").n;
        int         acs      = (int)e.data.GetField("acs").n;
        int         dcs      = (int)e.data.GetField("dcs").n;
        int         ahp      = (int)e.data.GetField("ahp").n;
        int         dhp      = (int)e.data.GetField("dhp").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.BattleResult, aname, dname, amods, dmods, aoap, doap, akilled, atouched, dkilled, dtouched, ahit, dhit, abattle, bbattle, aaap, daap, acs, dcs, ahp, dhp));
    }
Beispiel #2
0
    private void SelectDoneCallback(SocketIOEvent e)
    {
        Debug.Log("[O]select_done: " + e.ToString());
        string who = e.data.GetField("name").str;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.SelectDoneCallback, who));
    }
Beispiel #3
0
 public virtual void OnClientCompleteSetupSkills(SocketIOEvent obj)
 {
     Debug.LogWarning(obj.ToString());
     // COMPLETE TASK
     this.m_NextTask = "PlayScene";
     this.OnTaskCompleted();
 }
    void updateEnergyBar(SocketIOEvent e)
    {
        Debug.Log(e.data);
        Debug.Log(e.name);
        Debug.Log(e.ToString());
        float currValue = presidentImage.color.a - decreaseAmount;

        if (currValue < 0.9)
        {
            energyBar.gameObject.SetActive(true);
        }

        // energy Level 0-1
        if (currValue > 0)
        {
            presidentImage.color = new Color(1f, 1f, 1f, currValue);
            energySlider.value   = currValue;
            curr_energy          = currValue;
        }
        else
        {
            currValue            = 0;
            energySlider.value   = currValue;
            presidentImage.color = new Color(1f, 1f, 1f, currValue);
            isActive             = false;
        }
    }
Beispiel #5
0
    private void UpdateManaCallback(SocketIOEvent e)
    {
        Debug.Log("[O]update_mana: " + e.ToString());
        string who  = e.data.GetField("name").str;
        int    mana = (int)e.data.GetField("mana").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.UpdatePlayerMana, who, mana));
    }
Beispiel #6
0
        public virtual void OnClientUpdateEnergy(SocketIOEvent obj)
        {
            Debug.Log(obj.ToString());
            var currentEnergy = obj.data.GetField("current").ToString();
            var maxEnergy     = obj.data.GetField("max").ToString();

            this.m_LobbyManager.UpdateEnergyText(currentEnergy, maxEnergy);
        }
Beispiel #7
0
    private void SelectTargetCallback(SocketIOEvent e)
    {
        Debug.Log("[O]select_target: " + e.ToString());
        string who  = e.data.GetField("name").str;
        int    guid = (int)e.data.GetField("guid").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.SelectTargetCallback, who, guid));
    }
Beispiel #8
0
    private void DiscardCardCallback(SocketIOEvent e)
    {
        Debug.Log("[O]discard_card: " + e.ToString());
        string who  = e.data.GetField("name").str;
        int    guid = (int)e.data.GetField("guid").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.DiscardCardCallback, who, guid));
    }
Beispiel #9
0
    private void UpdateCardPowerCallback(SocketIOEvent e)
    {
        Debug.Log("[O]update_card_power: " + e.ToString());
        int guid  = (int)e.data.GetField("guid").n;
        int power = (int)e.data.GetField("power").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.UpdateCardPowerCallback, guid, power));
    }
Beispiel #10
0
    private void RemoveBuffCallback(SocketIOEvent e)
    {
        Debug.Log("[O]remove_buff: " + e.ToString());
        int cardGuid = (int)e.data.GetField("cguid").n;
        int buffGuid = (int)e.data.GetField("bguid").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.RemoveBuffCallback, cardGuid, buffGuid));
    }
Beispiel #11
0
        public virtual void OnClientGetRewardBattle(SocketIOEvent obj)
        {
            Debug.LogWarning(obj.ToString());
            var glory = obj.data.GetField("glory").ToString();
            var gold  = obj.data.GetField("gold").ToString();

            CUIMiniGameFightingManager.Instance.SetUpWinningBox("WINNING",
                                                                string.Format("YOU WIN x{0} GLORY and x{1} GOLD", glory, gold));
        }
Beispiel #12
0
        public virtual void OnClientReceiveDice(SocketIOEvent obj)
        {
            Debug.LogWarning("OnClientReceiveDice " + obj.ToString());
            var step      = int.Parse(obj.data.GetField("diceStep").ToString());
            var curEnergy = int.Parse(obj.data.GetField("currentEnergy").ToString());
            var maxEnergy = int.Parse(obj.data.GetField("maxEnergy").ToString());

            CGameManager.Instance.OnPlayerUpdateStep(step, curEnergy, maxEnergy);
        }
Beispiel #13
0
    private void UpdateSlotPowerCallback(SocketIOEvent e)
    {
        Debug.Log("[O]update_slot_power: " + e.ToString());
        string name  = e.data.GetField("name").str;
        int    slot  = (int)e.data.GetField("slot").n;
        int    power = (int)e.data.GetField("power").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.UpdateSlotPowerCallback, name, slot, power));
    }
Beispiel #14
0
    private void PlayCardCallback(SocketIOEvent e)
    {
        Debug.Log("[O]play_card " + e.ToString());
        string who  = e.data.GetField("name").str;
        int    guid = (int)e.data.GetField("guid").n;
        int    mana = (int)e.data.GetField("mana").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.PlayCardCallback, who, guid, mana));
    }
Beispiel #15
0
 private void OnDisconnect(SocketIOEvent evt)
 {
     started = false;
     Debugger.Log(Color.blue, "disconnect " + socket.IsConnected + " " + evt.ToString());
     if (OnDisconnectHandler != null)
     {
         OnDisconnectHandler(evt);
     }
 }
Beispiel #16
0
 private void OnOpen(SocketIOEvent evt)
 {
     started = true;
     Debugger.Log(Color.blue, "open " + socket.IsConnected + " " + evt.ToString());
     if (OnOpenHandler != null)
     {
         OnOpenHandler(evt);
     }
 }
Beispiel #17
0
    private void AddBuffCallback(SocketIOEvent e)
    {
        Debug.Log("[O]add_buff: " + e.ToString());
        int        cardGuid = (int)e.data.GetField("guid").n;
        JSONObject obj      = e.data.GetField("buff");
        int        buffGuid = (int)obj.GetField("guid").n;
        string     iconPath = obj.GetField("icon").str;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.AddBuffCallback, cardGuid, buffGuid, iconPath));
    }
Beispiel #18
0
    private void PlayCardSlotCallback(SocketIOEvent e)
    {
        Debug.Log("[O]play_card_slot: " + e.ToString());
        string who   = e.data.GetField("name").str;
        int    guid  = (int)e.data.GetField("guid").n;
        int    slot  = (int)e.data.GetField("slot").n;
        int    power = (int)e.data.GetField("power").n;

        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.PlayCardSlotCallback, who, guid, slot, power));
    }
Beispiel #19
0
        public virtual void OnClientReceiveResultPlayerQueue(SocketIOEvent obj)
        {
            Debug.LogWarning(obj.ToString());
            var responseData     = obj.data;
            var miniFightingData = TinyJSON.JSON.Load(responseData.ToString()).Make <CMiniFightingData> ();

            CTaskUtil.Set(CTaskUtil.MINI_FIGHTING_TEXT, responseData.ToString());
            CTaskUtil.Set(CTaskUtil.MINI_FIGHTING_DATA, miniFightingData);
            // COMPLETE TASK
            this.m_NextTask = "MiniGameFightingScene";
            this.OnTaskCompleted();
        }
Beispiel #20
0
    private void DrawCardCallback(SocketIOEvent e)
    {
        Debug.Log("[O]draw_card: " + e.ToString());
        string            who      = e.data.GetField("name").str;
        List <JSONObject> cardsObj = e.data.GetField("cards").list;
        List <Card>       cards    = new List <Card>();
        int deckN = (int)e.data.GetField("deckN").n;

        foreach (JSONObject obj in cardsObj)
        {
            int    guid  = (int)obj.GetField("guid").n;
            int    id    = (int)obj.GetField("id").n;
            string name  = obj.GetField("name").str;
            string color = obj.GetField("color").str;
            string ctype = obj.GetField("ctype").str;
            int    power = obj.GetField("power") == null ? 0 : (int)obj.GetField("power").n;
            string desc  = obj.GetField("desc") == null ? "" : obj.GetField("desc").str;
            int    cost  = (int)obj.GetField("cost").n;
            cards.Add(new Card(guid, id, name, color, ctype, power, desc, cost));
        }
        BoardBehaviour.CrossScenePayloads.Enqueue(new CrossScenePayload(BoardBehaviour.PlayerDrawCards, who, cards, deckN));
    }
Beispiel #21
0
        public virtual void OnClientReceiveChat(SocketIOEvent obj)
        {
            Debug.LogWarning("clientReceiveChat " + obj.ToString());
            var isHasChat = obj.data.HasField("chatStr");

            if (isHasChat)
            {
                // WARNING
                if (CSceneManager.Instance.GetActiveSceneName() != this.taskName)
                {
                    return;
                }
                var chatOwner = obj.data.GetField("chatOwner").ToString().Replace("\"", string.Empty);
                var chatStr   = obj.data.GetField("chatStr").ToString().Replace("\"", string.Empty);
                var chat      = chatOwner + ": " + chatStr;
                var chatData  = new CChatData()
                {
                    chatOwner = chatOwner,
                    chatStr   = chat,
                    isMine    = chatOwner == this.m_UserManager.currentHero.objectName
                };
                CUILobbyManager.Instance.ReceiveChatText(chatData);
            }
        }
Beispiel #22
0
 public void TestClose(SocketIOEvent e)
 {
     Debug.Log("[SocketIO] Close received: " + e.ToString());
 }
Beispiel #23
0
 public virtual void OnClientReceiveSkills(SocketIOEvent obj)
 {
     Debug.LogWarning("OnClientReceiveSkills " + obj.ToString());
 }
Beispiel #24
0
 public virtual void OnClientCancelPlayerQueue(SocketIOEvent obj)
 {
     Debug.LogWarning(obj.ToString());
 }
Beispiel #25
0
 //========= Connection Messages =============
 public void TestOpen(SocketIOEvent e)
 {
     print("[EventCenter] On Opened" + e.ToString());
 }
Beispiel #26
0
 public virtual void OnClientClosingGame(SocketIOEvent org)
 {
     Debug.LogWarning(org.ToString());
     CUIGameManager.Instance.PlayClosingAnimation();
 }
Beispiel #27
0
 public void TestError(SocketIOEvent e)
 {
     Debug.Log("[SocketIO] Error received: " + e.ToString());
 }
Beispiel #28
0
 private void OnRoomDenied(SocketIOEvent e)
 {
     print("[EventCenter] Room " + roomNumber + " Access Denied! " + e.ToString());
 }
 void sendCoors(SocketIOEvent ev)
 {
     Debug.Log(ev.ToString());
     //socket.Emit("connected");
 }