Exemplo n.º 1
0
 // Token: 0x06001770 RID: 6000 RVA: 0x00014B4E File Offset: 0x00012D4E
 public void OnSceneUnloaded(SceneRoot sceneRoot)
 {
     if (!Scenes.Manager.IsInsideActiveSceneBoundary(base.transform.position))
     {
         InstantiateUtility.Destroy(base.gameObject);
     }
 }
Exemplo n.º 2
0
    protected void TryBindSceneRelation(SceneConfigData _data)
    {
        if (_data == null || _data.sceneAsset == null || _data.sceneAsset.gameObjectRelationship == null)
        {
            Debug.LogError("The SceneConfigData has some problem , please check it !");
            return;
        }
        GameObject myScene = GameObject.Find(_data.sceneAsset.sceneName);

        if (myScene != null)
        {
            if (finalObjDic.ContainsKey(_data.sceneAsset.sceneName))
            {
                DestroyImmediate(finalObjDic[_data.sceneAsset.sceneName], true);
                finalObjDic.Remove(_data.sceneAsset.sceneName);
            }
            finalObjDic[_data.sceneAsset.sceneName] = myScene;
            SceneRoot sr = myScene.GetComponent <SceneRoot>();
            if (sr != null)
            {
                PlayGameStage s = GameCenter.curGameStage as PlayGameStage;
                if (s != null)
                {
                    s.SetSceneEffects(sr);
                }
            }
            ProcessGameObjectRelation(myScene, _data.sceneAsset.gameObjectRelationship);
        }
        else
        {
            Debug.LogError(_data.sceneAsset.sceneName + " 场景对象为空!请美术检查资源名称以及配置文件!");
        }
    }
Exemplo n.º 3
0
 public DungeonCrate(NavigationGrid navigationGrid, Character character, SceneRoot sceneRoot, DungeonKeyInventory keyInventory, Vector4 color)
 {
     this.navigationGrid = navigationGrid;
      this.character = character;
      this.sceneRoot = sceneRoot;
      this.keyInventory = keyInventory;
      this.color = color;
 }
Exemplo n.º 4
0
        private void OnSceneChanged(SceneRoot newSceneRoot)
        {
            SceneChangedDelegate handler = this.SceneChanged;

            if (handler != null)
            {
                handler(newSceneRoot);
            }
        }
Exemplo n.º 5
0
 // Token: 0x06003437 RID: 13367 RVA: 0x0002974B File Offset: 0x0002794B
 public void SetupGameplay(SceneRoot sceneRoot, WorldEventsOnAwake worldEventsOnAwake)
 {
     sceneRoot.MetaData.InitialValues.ApplyInitialValues();
     this.WarmUpResources();
     if (worldEventsOnAwake != null)
     {
         worldEventsOnAwake.Apply();
     }
     LateStartHook.AddLateStartMethod(new Action(this.CreateCheckpoint));
 }
Exemplo n.º 6
0
        private void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }

            // Consider case where content and scene manager are in one scene.
            this.mainScene = FindObjectOfType <SceneRoot>();
        }
Exemplo n.º 7
0
    public override void PanelInit()
    {
        base.PanelInit();
        AddButtonClick("News", HandleUnityAction);
        AddButtonClick("Manual", HandleUnityAction1);

        //Get UI elements
        m_data      = transform.Find("Data").GetComponent <Text> ();
        m_sceneRoot = GameObject.Find("SceneRoot").GetComponent <SceneRoot> ();
    }
Exemplo n.º 8
0
    protected void OnClickRealShadow()
    {
        SystemSettingMng.RealTimeShadow = realShadow.value;
        SceneRoot instance = SceneRoot.GetInstance();

        if (instance != null)
        {
            instance.DirectionalLightActive(SystemSettingMng.RealTimeShadow);
        }
    }
Exemplo n.º 9
0
        private void OnLevelLoaded()
        {
            // Find new scene root.
            SceneRoot sceneRoot = this.FindSceneRoot(this.loadingSceneId);

            this.mainScene = sceneRoot;
            Debug.Log("Changed to scene '" + this.loadingSceneId + "'.");

            // Dispatch event.
            this.OnSceneChanged(this.mainScene);
        }
Exemplo n.º 10
0
 void Awake()
 {
     sceneRootInstance = this;
     if (directionalLight == null)
     {
         directionalLight = transform.GetComponentInChildrenFast <Light>();
     }
     if (effecthelpers == null || effecthelpers.Length < 1)
     {
         effecthelpers = transform.GetComponentsInChildren <SceneEffectHelper> ();
     }
 }
Exemplo n.º 11
0
    // Token: 0x06001777 RID: 6007 RVA: 0x0007B7BC File Offset: 0x000799BC
    public override void Awake()
    {
        SuspensionManager.Register(this);
        if (this.FrustrumOptimized)
        {
            CameraFrustumOptimizer.Register(this);
        }
        SceneRoot sceneRoot = SceneRoot.FindFromTransform(base.transform);

        if (sceneRoot != null)
        {
            this.SceneRootGUID = sceneRoot.MetaData.SceneMoonGuid;
        }
        base.Awake();
    }
Exemplo n.º 12
0
        /* Drtaws all GameObjects in sceneObjects that
         * implements IDrawable.
         */
        public void Draw(Rendering.RenderQueue renderQueue)
        {
            SceneRoot.ResolveDirty();

            foreach (GameObject gameObject in sceneObjects)
            {
                if (gameObject is IDrawable)
                {
                    // TODO: Implement support for additional drawables.

                    var modelComp = gameObject.Components.Get <_ModelComponent>();

                    if (modelComp != null)
                    {
                        renderQueue.Stage(modelComp.Model, gameObject.WorldMatrix);
                    }
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Draw this SceneGraph.
        /// </summary>
        /// <param name="ctx">
        /// The <see cref="GraphicsContext"/> used for drawing.
        /// </param>
        /// <param name="programOverride">
        /// A <see cref="ShaderProgram"/> that overrides the default one used for rendering the batch. It can be null.
        /// </param>
        public void Draw(GraphicsContext ctx, ShaderProgram programOverride)
        {
            CheckCurrentContext(ctx);

            // View parameters
            SceneRoot.LocalProjection          = ProjectionMatrix;
            SceneRoot.LocalModel               = new ModelMatrix();
            SceneRoot.LocalModelView           = ViewMatrix;
            SceneRoot.LocalModelViewProjection = new ModelMatrix((Matrix4x4)ProjectionMatrix.Multiply(ViewMatrix));

            using (SceneGraphContext ctxScene = new SceneGraphContext(this)) {
                ObjectBatchContext objectBatchContext = new ObjectBatchContext();

                // Traverse the scene graph
                SceneRoot.TraverseDirect(ctx, ctxScene, _TraverseDrawContext, objectBatchContext);
                // Generate shadow maps
                if ((SceneFlags & SceneGraphFlags.Lighting) != 0 && (SceneFlags & SceneGraphFlags.ShadowMaps) != 0)
                {
                    _LightManager.GenerateShadowMaps(ctx, this);
                }

                // Sort geometries
                List <SceneObjectBatch> sceneObjects = objectBatchContext.Objects;
                if (((SceneFlags & SceneGraphFlags.StateSorting) != 0) && (_SorterRoot != null))
                {
                    sceneObjects = _SorterRoot.Sort(objectBatchContext.Objects);
                }

                // Draw all batches
                KhronosApi.LogComment("*** Draw Graph");
                foreach (SceneObjectBatch objectBatch in sceneObjects)
                {
                    objectBatch.Draw(ctx, programOverride);
                }

                // Debug: shadow maps
                if ((SceneFlags & SceneGraphFlags.Lighting) != 0 && (SceneFlags & SceneGraphFlags.ShadowMaps) != 0)
                {
                    DisplayShadowMaps(ctx);
                }
            }
        }
        protected override void Start()
        {
            base.Start();
            Utils.SetDefaultShaderColor();

            SceneRoot.PushBackBtnHandler(OnBtnClose);
            _uiArchiveLobby.CallBack   = OnBtnClose;
            _uiArchiveLobby.CallDialog = SetPlayDirector;

            ShowUI(true);

            ThreeDPreviewStack.Instance.BGPlace = _bgPlace;

            LoadMaster();

            _directorIntro.gameObject.SetActiveFast(true);
            _directorIntro.Play();
            _directorIntro.stopped += DirectorOnStopped;
            _directorLoop.stopped  += DirectorOnStopped;
        }
        protected override void OnDestroy()
        {
            base.OnDestroy();

            if (SingletonBase.ApplicationIsQuitting)
            {
                return;
            }

            if (_bgSetting != null)
            {
                _bgSetting.PopShader();
            }

            _directorIntro.stopped -= DirectorOnStopped;
            _directorLoop.stopped  -= DirectorOnStopped;

            StopSoundClip(_directorIntro);
            StopSoundClip(_directorLoop);

            SceneRoot.PopBackBtnHandler(OnBtnClose);
        }
Exemplo n.º 16
0
        private void OnUpdateInternal(object sender, FrameEventArgs e)
        {
            DT = stopWatch.ElapsedMilliseconds / 1000.0f;
            stopWatch.Restart();
            ActiveCamera.Update(DT);
            MouseHandler.Update();
            KeyboardHandler.Update();
            OnUpdate();
            SceneRoot.Update(DT);

            //PhysicsWorld.Step(DT, true);


            foreach (var c in destroyed)
            {
                if (c != SceneRoot)
                {
                    c.DestroyInternal();
                }
            }
            destroyed.Clear();
        }
Exemplo n.º 17
0
        /* If not already created and up to date, this method
         * constructs a new list of Meshes to be rendered.
         *
         * * return     flattened list of GameObjects with meshes
         */
        public Rendering.RenderQueue GetRenderQueue()
        {
            if (IsDirty)
            {
                Flatten();
            }

            Rendering.RenderQueue renderQueue = new Rendering.RenderQueue();

            SceneRoot.ResolveDirty();

            foreach (GameObject gameObject in sceneObjects)
            {
                var modelComp = gameObject.Components.Get <_ModelComponent>();

                if (modelComp != null)
                {
                    renderQueue.Stage(modelComp.Model, gameObject.WorldMatrix);
                }
            }
            return(renderQueue);
        }
        public static void OnDrawSceneGizmos(SceneRoot test, GizmoType gizmoType)
        {
            Gizmos.color = Color.blue;
            GameObject selectObj = Selection.activeGameObject;
            var        sceneInfo = SceneExportEditor.currentSceneInfo;

            if (sceneInfo == null)
            {
                return;
            }
            for (var xIndex = 0; xIndex <= sceneInfo.xCellCount; xIndex++)
            {
                Vector3 horizontalButton = new Vector3(sceneInfo.xMin + xIndex * sceneInfo.xCellSize, 5, sceneInfo.zMin);
                Vector3 horizontalTop    = new Vector3(sceneInfo.xMin + xIndex * sceneInfo.xCellSize, 5, sceneInfo.zMin + sceneInfo.zLenth);
                Gizmos.DrawLine(horizontalButton, horizontalTop);
            }
            for (var zIndex = 0; zIndex <= sceneInfo.zCellCount; zIndex++)
            {
                Vector3 horizontalButton = new Vector3(sceneInfo.xMin, 5, sceneInfo.zMin + zIndex * sceneInfo.zCellSize);
                Vector3 horizontalTop    = new Vector3(sceneInfo.xMin + sceneInfo.xLenth, 5, sceneInfo.zMin + +zIndex * sceneInfo.zCellSize);
                Gizmos.DrawLine(horizontalButton, horizontalTop);
            }
        }
Exemplo n.º 19
0
 void SetDefault()
 {
     StopAllCoroutines();
     if (GameCenter.systemSettingMng.IsPowerSaving)
     {
         GameCenter.systemSettingMng.RendererQualityNoRecord = qualityType;
         GameCenter.systemSettingMng.OpenSoundEffect         = openSound;
         GameCenter.systemSettingMng.OpenMusic = openMusic;
         Application.targetFrameRate           = 30;
         SystemSettingMng.RealTimeShadow       = shadow;
         SceneRoot instance = SceneRoot.GetInstance();
         if (instance != null)
         {
             instance.DirectionalLightActive(SystemSettingMng.RealTimeShadow);
         }
         if (GameCenter.instance.isPlatform)
         {
             LynSdkManager.Instance.DCBrightness((int)ScreenLightSet.RESTORE);
         }
     }
     GameCenter.uIMng.ReleaseGUI(GUIType.POWERSAVING);
     GameCenter.systemSettingMng.IsPowerSaving = false;
 }
Exemplo n.º 20
0
    void SetPowerSaving()
    {
        openSound   = GameCenter.systemSettingMng.OpenSoundEffect;
        qualityType = GameCenter.systemSettingMng.CurRendererQuality;
        openMusic   = GameCenter.systemSettingMng.OpenMusic;
        shadow      = SystemSettingMng.RealTimeShadow;
        GameCenter.systemSettingMng.RendererQualityNoRecord = SystemSettingMng.RendererQuality.LOW;
        GameCenter.systemSettingMng.OpenMusic       = false;
        GameCenter.systemSettingMng.OpenSoundEffect = false;
        SystemSettingMng.RealTimeShadow             = false;
        SceneRoot instance = SceneRoot.GetInstance();

        if (instance != null)
        {
            instance.DirectionalLightActive(SystemSettingMng.RealTimeShadow);
        }
        if (GameCenter.instance.isPlatform)
        {
            LynSdkManager.Instance.DCBrightness((int)ScreenLightSet.HALF);
        }
        Application.targetFrameRate = 10;
        GameCenter.systemSettingMng.IsPowerSaving = true;
        tipObj.SetActive(false);
    }
Exemplo n.º 21
0
        private void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }

            // Consider case where content and scene manager are in one scene.
            this.mainScene = FindObjectOfType<SceneRoot>();
        }
Exemplo n.º 22
0
 private void OnSceneChanged(SceneRoot newSceneRoot)
 {
     SceneChangedDelegate handler = this.SceneChanged;
     if (handler != null)
     {
         handler(newSceneRoot);
     }
 }
Exemplo n.º 23
0
	void Awake ()
	{
		SceneRoot.instance = this;
	}
Exemplo n.º 24
0
        public void SendMessage(Message msg)
        {
            GameObjectManager.Get.OnMessage(msg);

            if (GameObjectManager.Get.IsRegisteredListener(msg.Action))
            {
                if (msg.Traverse.HasState(Traverses.ROOT))
                {
                    msg.Traverse.ResetState(Traverses.ROOT);
                    if (Root != null)
                    {
                        Root.SendMessage(msg);
                        return;
                    }
                }

                if (msg.Traverse.HasState(Traverses.SCENEROOT))
                {
                    msg.Traverse.ResetState(Traverses.SCENEROOT);
                    if (SceneRoot != null)
                    {
                        SceneRoot.SendMessage(msg);
                        return;
                    }
                }

                // check only to prevent from settings traverses to both: child first and beh first
                bool childfirst = false;

                // traverse children at first
                if (msg.Traverse.HasState(Traverses.CHILD_FIRST))
                {
                    childfirst = true;
                    if (_children != null)
                    {
                        foreach (var child in _children.ToList())
                        {
                            child.SendMessage(msg);
                        }
                    }
                }

                if (_behaviors != null)
                {
                    foreach (var behavior in _behaviors)
                    {
                        if ((behavior.BehState == BehaviorState.ACTIVE_MESSAGES || behavior.BehState == BehaviorState.ACTIVE_ALL) &&
                            (msg.SenderType != SenderType.BEHAVIOR || behavior.Id != msg.OwnerId) &&
                            (msg.Category == ElementType.ALL || behavior.ElemType == msg.Category))
                        {
                            if (behavior.MessageListeners.HasState(msg.Action))
                            {
                                behavior.OnMessage(msg);
                            }
                        }
                    }
                }

                // traverse children at last
                if (!childfirst && msg.Traverse.HasState(Traverses.BEH_FIRST))
                {
                    if (_children != null)
                    {
                        foreach (var child in _children.ToList())
                        {
                            child.SendMessage(msg);
                        }
                    }
                }
            }
        }
Exemplo n.º 25
0
 public void AddObjectAsRootChild(GameObject gameObject)
 {
     SceneRoot.AddChild(gameObject);
     IsDirty = true;
 }
Exemplo n.º 26
0
        private void OnLevelLoaded()
        {
            // Find new scene root.
            SceneRoot sceneRoot = this.FindSceneRoot(this.loadingSceneId);
            this.mainScene = sceneRoot;
            Debug.Log("Changed to scene '" + this.loadingSceneId + "'.");

            // Dispatch event.
            this.OnSceneChanged(this.mainScene);
        }
Exemplo n.º 27
0
 public void SetSceneRoots(int buildIndex, SceneRoot sceneRoot)
 {
     sceneRoots [buildIndex - 2] = sceneRoot;
     sceneRoots [buildIndex - 2].gameObject.SetActive(false);
 }
Exemplo n.º 28
0
    /// <summary>
    /// Awake this instance.
    /// </summary>
    void Awake()
    {
        //
        instance = this;

        //
        mStates = new List<StateBase>();
        mStates.Add( new StateMenu() );
        mStates.Add( new StateEnd() );

        foreach ( StateBase sb in mStates )
        {
            if ( sb.Name == Application.loadedLevelName )
            {
                mCurrentState = sb;
            }
        }

        if ( mCurrentState == null )
        {
            mCurrentState = new StateLevel();
        }

        mCurrentState.Awake();
    }