Exemplo n.º 1
0
 public bool Init(LeaverScene _this, SceneParam param)
 {
     //Obstacle.Load();
     _this.Active         = false;
     _this.TableSceneData = Table.GetScene(_this.TypeId);
     //Param = param;
     return(true);
 }
Exemplo n.º 2
0
        public Scene CreateScene(SceneManager _this,
                                 int serverId,
                                 int sceneId,
                                 ulong regionId        = 0,
                                 SceneParam sceneParam = null)
        {
            Dictionary <int, Dictionary <ulong, Scene> > servers = null;

            if (!_this.ScenesDic.ContainsKey(serverId))
            {
                servers = new Dictionary <int, Dictionary <ulong, Scene> >();
                _this.ScenesDic.Add(serverId, servers);
            }
            else
            {
                servers = _this.ScenesDic[serverId];
            }

            Dictionary <ulong, Scene> scenes = null;

            if (!servers.ContainsKey(sceneId))
            {
                scenes = new Dictionary <ulong, Scene>();
                servers.Add(sceneId, scenes);
            }
            else
            {
                scenes = servers[sceneId];
            }

            //var scene = new Scene {TypeId = sceneId, ServerId = serverId, Guid = regionId};
            Scene scene;

            if (sceneId == 0)
            {
                scene = new LeaverScene();
                scene.Init(sceneParam);
            }
            else
            {
                scene = SceneRegister.CreateScene(sceneId, serverId, regionId);
                scene.Init(sceneParam);
            }


            scenes.Add(regionId, scene);
            _this.Scenes.Add(regionId, scene);
            try
            {
                scene.OnCreate();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }

            return(scene);
        }
Exemplo n.º 3
0
 public bool LeaveScene(LeaverScene _this, ObjBase obj, ReasonType reason = ReasonType.VisibilityChanged)
 {
     obj.LeavelScene();
     _this.RemoveObj(obj);
     return(true);
 }
Exemplo n.º 4
0
 public bool EnterScene(LeaverScene _this, ObjBase obj)
 {
     _this.AddObj(obj);
     obj.EnterScene(_this);
     return(true);
 }