Exemple #1
0
        public void UF_OnAwake(Camera camera)
        {
            float _far       = 0;
            float _hl_height = 0;
            float _hl_length = 0;

            if (camera.orthographic)
            {
                float width  = camera.orthographicSize * camera.aspect * 2.0f;
                float height = width / camera.aspect;
                _far       = camera.nearClipPlane / 2.0f + m_OffsetZ;
                _hl_length = width / 2.0f + m_OffsetW;
                _hl_height = height / 2.0f + m_OffsetW;
            }
            else
            {
                _far       = camera.nearClipPlane + m_OffsetZ;
                _hl_height = _far * Mathf.Tan(Mathf.Deg2Rad * camera.fieldOfView / 2.0f) + m_OffsetW;
                _hl_length = _hl_height * camera.aspect + m_OffsetW;
            }

            GameObject gameObject = new GameObject("ScreenMask");

            gameObject.transform.parent           = camera.transform;
            gameObject.transform.localPosition    = Vector3.zero;
            gameObject.transform.localEulerAngles = Vector3.zero;

            Vector2[] _uv = new Vector2[4] {
                new Vector2(1, 0), new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 1)
            };
            Vector3[] _vertices = new Vector3[4] {
                new Vector3(-_hl_length, _hl_height, _far),
                new Vector3(-_hl_length, -_hl_height, _far),
                new Vector3(_hl_length, -_hl_height, _far),
                new Vector3(_hl_length, _hl_height, _far)
            };
            int[] _index = new int[6] {
                0, 2, 1, 0, 3, 2
            };
            Mesh       _mesh = new Mesh();
            MeshFilter _mf   = gameObject.GetComponent <MeshFilter>();

            if (_mf == null)
            {
                _mf = gameObject.AddComponent <MeshFilter>();
            }
            MeshRenderer _mr = gameObject.GetComponent <MeshRenderer>();

            if (_mr == null)
            {
                _mr = gameObject.AddComponent <MeshRenderer>();
            }
            _mf.mesh        = _mesh;
            _mesh.vertices  = _vertices;
            _mesh.uv        = _uv;
            _mesh.triangles = _index;
            _mr.material    = new Material(ShaderManager.UF_GetInstance().UF_Find("Game/Transparent/ScreenBlackMask"));
            m_Render        = _mr;
            m_GameObject    = gameObject;
        }
 public void UF_SetMaterialShader(string shaderName)
 {
     if (string.IsNullOrEmpty(shaderName))
     {
         material = ShaderManager.UF_GetInstance().UF_GetRayMaterial(false);
     }
     else
     {
         material = ShaderManager.UF_GetInstance().UF_GetMaterial(shaderName);
     }
 }
Exemple #3
0
 public void UF_SetShader(string shaderName)
 {
     if (m_ListMats == null)
     {
         return;
     }
     m_IsChanged = true;
     foreach (Material mat in m_ListMats.Keys)
     {
         if (mat.shader != null)
         {
             mat.shader = ShaderManager.UF_GetInstance().UF_Find(shaderName);
         }
     }
 }
Exemple #4
0
        void Awake()
        {
            try{
                DontDestroyOnLoad(this);
                s_GameMaim = this;
                s_Root     = this.gameObject;

                FrameHandle.UF_AddHandle(Debugger.UF_GetInstance());
                //System
                FrameHandle.UF_AddHandle(MessageSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(UpgradeSystem.UF_GetInstance());
                //FrameHandle.UF_AddHandle(NetworkSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(AssetSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(CEntitySystem.UF_GetInstance());
                //FrameHandle.UF_AddHandle(LuaFramework.UF_GetInstance());
                //manager
                FrameHandle.UF_AddHandle(PDataManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(ShaderManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(AudioManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(UIManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(FXManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(NavigateManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(MotionManager.UF_GetInstance());
                //FrameHandle.UF_AddHandle(PerformActionManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RaycastManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(VoiceManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RenderPreviewManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RefObjectManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(CheckPointManager.UF_GetInstance());

                FrameHandle.UF_AddHandle(SimulationManager.Instance);

                //setting
                GTime.FrameRate     = 60;
                GTime.FixedTimeRate = 0.016f;
                GTime.RunDeltaTime  = 0.016f;

                Screen.sleepTimeout = SleepTimeout.NeverSleep;
                VendorSDK.UF_Init();

                //VestBinder.Bind();
            }
            catch (System.Exception e) {
                Debugger.UF_Exception(e);
            }
        }
Exemple #5
0
        protected override void OnPopulateMesh(VertexHelper toFill)
        {
            base.OnPopulateMesh(toFill);
            List <UIVertex> tempVertexs = ListCache <UIVertex> .Acquire();

            toFill.GetUIVertexStream(tempVertexs);
            if (tempVertexs.Count >= 6 && MRenderer != null && MFilter != null)
            {
                m_TempPoints [0] = tempVertexs [0].position;
                m_TempPoints [1] = tempVertexs [1].position;
                m_TempPoints [2] = tempVertexs [2].position;
                m_TempPoints [3] = tempVertexs [4].position;

                MMesh.vertices  = m_TempPoints;
                MMesh.triangles = s_Triangles;

                MFilter.mesh             = MMesh;
                MRenderer.sharedMaterial = ShaderManager.UF_GetInstance().UF_GetUIModelMaterial(true);
            }
            ListCache <UIVertex> .Release(tempVertexs);
        }
Exemple #6
0
 public void UF_SetGrey(bool opera)
 {
     this.material = opera ? ShaderManager.UF_GetInstance().UF_GetUIGreyMaterial() : null;
 }
Exemple #7
0
        public void UF_DrawInfo(Rect rect)
        {
            if (m_CurrentTag == TAG_INFO_ENTITY)
            {
                GUILayout.BeginHorizontal();
                var sb = StrBuilderCache.Acquire();
                sb.AppendLine(string.Format("== Active Count: {0} ==", CEntitySystem.UF_GetInstance().ActiveCount));
                sb.AppendLine();
                sb.AppendLine(CEntitySystem.UF_GetInstance().UF_GetActiveEntityInfo());
                GUI.color = Color.green;
                GUILayout.Box(sb.ToString());

                sb.Clear();
                sb.AppendLine(string.Format("== Pool Count: {0} ==", CEntitySystem.UF_GetInstance().PoolCount));
                sb.AppendLine();
                sb.AppendLine(CEntitySystem.UF_GetInstance().UF_GetPoolEntityInfo());
                GUI.color = Color.white;
                GUILayout.Box(sb.ToString());
                StrBuilderCache.Release(sb);
                GUILayout.EndHorizontal();
            }
            else if (m_CurrentTag == TAG_INFO_AB)
            {
                GUILayout.Label("Total Count: " + AssetSystem.UF_GetInstance().count);
                GUILayout.Box(AssetSystem.UF_GetInstance().ToString());
            }
            else if (m_CurrentTag == TAG_LOAD_TRACK)
            {
                if (Debugger.UF_GetInstance().MsgTrackers.ContainsKey(Debugger.TRACK_RES_LOAD))
                {
                    MsgTracker tracker = Debugger.UF_GetInstance().MsgTrackers[Debugger.TRACK_RES_LOAD];
                    GUILayout.Box(tracker.UF_ForeachToString(UF_TrackMsgForeach));
                }
            }
            else if (m_CurrentTag == TAG_UI)
            {
                var lastAlignment = GUI.skin.box.alignment;
                GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                GUILayout.Box(UIManager.UF_GetInstance().ToString());
                GUI.skin.box.alignment = lastAlignment;
            }
            else if (m_CurrentTag == TAG_RefObject)
            {
                GUILayout.Box(RefObjectManager.UF_GetInstance().ToString());
            }
            else if (m_CurrentTag == TAG_AUDIO)
            {
                GUILayout.Box(AudioManager.UF_GetInstance().ToString());
            }
            else if (m_CurrentTag == TAG_SHADER)
            {
                GUILayout.Box(ShaderManager.UF_GetInstance().UF_GetShadersInfo());
            }
            else if (m_CurrentTag == TAG_ASSETDB)
            {
                int countBundle   = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Bundle);
                int countRebundle = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Rebundle);
                int countRuntimes = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Runtimes);
                int countNone     = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.None);

                GUILayout.Box(string.Format("Bundle-> {0}", countBundle));
                GUILayout.Box(string.Format("Runtime-> {0}", countRuntimes));
                GUILayout.Box(string.Format("Rebundle-> {0}", countRebundle));
                GUILayout.Box(string.Format("None-> {0}", countNone));
            }
        }