Ejemplo n.º 1
0
    void VRPlaycePort(IMessage msg)
    {
        PlacePortObj ppo = (PlacePortObj)msg.Data;

        //Debug.LogWarning(JsonUtility.ToJson(ppo));
        if (ppo.isGroup)
        {
            MessageDispatcher.SendMessage(true, VrDispMessageType.AllPlaceTo.ToString(), ppo.nowselectobj == null ? "" : ppo.nowselectobj.name, 0);
        }
        else
        {
            if (ppo.telekind == WsTeleportKind.myself || ppo.telekind == WsTeleportKind.all)
            {
                WsPlaceMark newteleinfo = new WsPlaceMark
                {
                    id    = mStaticThings.I.mAvatarID,
                    dname = ppo.nowselectobj == null ? "" : ppo.nowselectobj.name
                };

                WsPlaceMarkList wmlist = new WsPlaceMarkList
                {
                    kind  = WsPlaycePortKind.single,
                    gname = mStaticThings.I.nowGroupName,
                    id    = mStaticThings.I.mAvatarID,
                    marks = new List <WsPlaceMark>()
                };
                wmlist.marks.Add(newteleinfo);

                PlayceToNew(newteleinfo);
                if (mStaticThings.I.SendAvatar)
                {
                    MessageDispatcher.SendMessage(this, WsMessageType.SendPlaceMark.ToString(), wmlist, 0);
                }
            }
            else if (ppo.telekind == WsTeleportKind.single)
            {
                WsPlaceMark newsingleinfo = new WsPlaceMark
                {
                    id    = mStaticThings.I.NowSelectedAvararid,
                    dname = ppo.nowselectobj == null ? "" : ppo.nowselectobj.name
                };
                WsPlaceMarkList wmlist = new WsPlaceMarkList
                {
                    kind  = WsPlaycePortKind.single,
                    gname = mStaticThings.I.nowGroupName,
                    id    = mStaticThings.I.mAvatarID,
                    marks = new List <WsPlaceMark>()
                };
                wmlist.marks.Add(newsingleinfo);
                PlayceToNew(newsingleinfo);
                MessageDispatcher.SendMessage(this, WsMessageType.SendPlaceMark.ToString(), wmlist, 0);
            }
        }
    }
Ejemplo n.º 2
0
    void InitConnectGroup(WsPlaceMarkList nowwpm)
    {
        if (nowwpm.gname == null || nowwpm.gname == "")
        {
            GoStartGroup();
            return;
        }
        MarkAllPlayce(nowwpm, false);
        //Debug.LogWarning(JsonUtility.ToJson(nowwpm));
        Dictionary <string, string> temdic = new Dictionary <string, string>();

        foreach (var itemc in nowwpm.marks)
        {
            if (itemc.id != mStaticThings.I.mAvatarID)
            {
                temdic.Add(itemc.id, itemc.dname);
            }
        }
        Transform targetgroup = Playces.Find(nowwpm.gname);


        if (targetgroup == null)
        {
            targetgroup = Playces.Find(StartGroup.name);
        }
        if (targetgroup == null)
        {
            return;
        }
        mStaticThings.I.nowGroupName = targetgroup.name;
        VRPlayceGroup vrp = targetgroup.GetComponent <VRPlayceGroup>();

        if (vrp != null)
        {
            if (mStaticThings.I.SendAvatar)
            {
                foreach (var item in vrp._VRPlayceDots)
                {
                    if (item != null)
                    {
                        if (!temdic.ContainsValue(item.name))
                        {
                            PlacePortObj ppo = new PlacePortObj
                            {
                                nowselectobj = item.gameObject,
                                telekind     = WsTeleportKind.myself,
                                isGroup      = false
                            };
                            MessageDispatcher.SendMessage(this, VrDispMessageType.VRPlaycePort.ToString(), ppo, 0);
                            return;
                        }
                    }
                }
            }
            else
            {
                if (vrp._VRPlayceDots[vrp._VRPlayceDots.Count - 1] != null)
                {
                    PlacePortObj ppo = new PlacePortObj
                    {
                        nowselectobj = vrp._VRPlayceDots[vrp._VRPlayceDots.Count - 1].gameObject,
                        telekind     = WsTeleportKind.myself,
                        isGroup      = false
                    };
                    MessageDispatcher.SendMessage(this, VrDispMessageType.VRPlaycePort.ToString(), ppo, 0);
                }
                return;
            }
        }
    }