Esempio n. 1
0
        /// <summary>
        /// Sends a quick chat flat message.
        /// </summary>
        /// <param name="playerIndex">The index of the bot's car.</param>
        /// <param name="teamOnly">Flag indicating whether the quick chat message is for the player's team only or not.</param>
        /// <param name="quickChat">The quick chat selection to send.</param>
        public static void SendQuickChatFlat(int playerIndex, bool teamOnly, QuickChatSelection quickChat)
        {
            FlatBufferBuilder builder = new FlatBufferBuilder(50);

            var offset = QuickChat.CreateQuickChat(
                builder,
                quickChat,
                playerIndex,
                teamOnly);

            builder.Finish(offset.Value);
            byte[] bufferBytes = builder.SizedByteArray();
            SendQuickChat(bufferBytes, bufferBytes.Length);
        }
Esempio n. 2
0
    void quickchat(int sender, int id)
    {
        RoomMgr rm    = RoomMgr.GetInstance();
        int     local = rm.getLocalIndexByID(sender);

        Seat s = seats [local].GetComponent <Seat>();

        Chat      chat = GetComponent <Chat>();
        QuickChat qc   = chat.getQuickChat(id);

        if (qc != null)
        {
            s.chat(qc.text);
            AudioManager.GetInstance().PlayQuickChat(qc.audio);
        }
    }
Esempio n. 3
0
    void Awake()
    {
        scroll = transform.Find(listPath).GetComponent <UIScrollView>();
        mGrid  = transform.Find(listPath + "/grid");
        InitEventHandler();

        Transform emojis = transform.Find("Chat/emoji/table");

        for (int i = 0; i < 20; i++)
        {
            int j = i;
            PUtils.onClick(emojis.GetChild(j), () => {
                onEmojiClicked(j);
            });
        }

        quicks.Add(new QuickChat("打快一点呀!", "1"));
        quicks.Add(new QuickChat("快点撒,我等到花儿都谢了!", "2"));
        quicks.Add(new QuickChat("牌太好了,打哪张呢?", "3"));
        quicks.Add(new QuickChat("不要乱催", "4"));
        quicks.Add(new QuickChat("别吵啦!", "5"));
        quicks.Add(new QuickChat("三缺一,我来的正好", "6"));
        quicks.Add(new QuickChat("被你这个老麻将盯上", "7"));
        quicks.Add(new QuickChat("见鬼了,这烂牌", "8"));
        quicks.Add(new QuickChat("喔天,打错牌了", "9"));
        quicks.Add(new QuickChat("风头不好,明天再约", "10"));
        quicks.Add(new QuickChat("输完回家睡觉", "11"));

        Transform qchats = transform.Find("Chat/qchats/grid");

        for (int i = 0; i < quicks.Count; i++)
        {
            int        j     = i;
            GameObject ob    = Instantiate(qcItem, qchats) as GameObject;
            UILabel    label = ob.GetComponentInChildren <UILabel>();
            QuickChat  qc    = quicks[i];

            label.text = qc.text;

            PUtils.onClick(ob, () => {
                onQuickChatClicked(j);
            });
        }

        qchats.GetComponent <UIGrid>().Reposition();
    }
Esempio n. 4
0
        /// <summary>
        /// Sends a quick chat flat message.
        /// </summary>
        /// <param name="playerIndex">The index of the bot's car.</param>
        /// <param name="teamOnly">Flag indicating whether the quick chat message is for the player's team only or not.</param>
        /// <param name="quickChat">The quick chat selection to send.</param>
        public static void SendQuickChatFlat(int playerIndex, bool teamOnly, QuickChatSelection quickChat)
        {
            FlatBufferBuilder builder = new FlatBufferBuilder(50);

            var offset = QuickChat.CreateQuickChat(
                builder,
                quickChat,
                playerIndex,
                teamOnly);

            builder.Finish(offset.Value);
            byte[] bufferBytes = builder.SizedByteArray();
            int    status      = SendQuickChat(bufferBytes, bufferBytes.Length);

            if (status > 0)
            {
                throw NewRLBotCoreException((RLBotCoreStatus)status);
            }
        }
Esempio n. 5
0
    void addItem(ChatItem item)
    {
        Transform _item = getItem(mChatItems.Count);

        bool self = item.sender == GameMgr.getUserMgr().userid;

        Transform left    = _item.Find("left");
        Transform right   = _item.Find("right");
        Transform current = null;

        left.gameObject.SetActive(!self);
        right.gameObject.SetActive(self);
        current = self ? right : left;

        Debug.Log("setIcon: " + item.sender);
        GameObject icon   = current.Find("icon").gameObject;
        IconLoader loader = icon.AddComponent <IconLoader>();

        loader.setUserID(item.sender);
        //icon.GetComponent<IconLoader>().setUserID(item.sender);

        int        type      = item.type;
        GameObject btn_voice = current.Find("btn_voice").gameObject;
        GameObject voice     = current.Find("voice").gameObject;
        GameObject text      = current.Find("text").gameObject;
        GameObject len       = current.Find("len").gameObject;
        GameObject emoji     = current.Find("emoji").gameObject;

        item.vobj = voice;

        text.SetActive(type == 0 || type == 3);
        btn_voice.SetActive(type != 2);
        len.SetActive(type == 1);
        voice.SetActive(false);
        emoji.SetActive(type == 2);

        if (type == 1)
        {
            PUtils.onClick(current.Find("btn_voice"), () => {
                playVoiceItem(item);
            });

            len.GetComponent <UILabel> ().text = (item.voice.time / 1000) + "''";
        }
        else if (type == 0)
        {
            text.GetComponent <UILabel> ().text = item.text;
        }
        else if (type == 2)
        {
            emoji.GetComponent <UISprite> ().spriteName = "face_" + (item.emoji + 1);
        }
        else if (type == 3)
        {
            QuickChat qc = getQuickChat(item.qcid);
            text.GetComponent <UILabel> ().text = qc != null ? qc.text : "";
        }

        mChatItems.Add(item);
        updateItems(mChatItems.Count);
    }