コード例 #1
0
    public override void Handle(object sender, IMessage packet)
    {
        base.Handle(sender, packet);
        GCEnterInstance data = packet as GCEnterInstance;

        //处理完数据和逻辑后,发送消息通知其他模块,绝对不可以直接操作UI等Unity主线程的东西!
        if (data.Result == 0)
        {
            InstanceTableSetting instanceTable = InstanceTableSettings.Get(data.InstanceId);
            if (instanceTable == null)
            {
                Debug.LogError("待进入的场景不存在!" + data.InstanceId);
                return;
            }

            SceneMgr.ChangeScene(instanceTable.SceneId);
            MapMgr.Create(data.InstanceId);
            MapMgr.Instance.MyMapPlayer.Update(data.MapPlayerData);
        }
        else
        {
            Debug.LogError("进入失败!" + data.Result);
        }
    }