예제 #1
0
 public static U3DFuncWrap Instance()
 {
     if (m_Instance == null)
     {
         m_Instance = new U3DFuncWrap();
     }
     return(m_Instance);
 }
예제 #2
0
    //public static int LayerMaskInputClick = LayerMaskTerrainBuilding | LayerMaskEntity | LayerMaskClickable;         //点击鼠标时需要考虑的layers

    public static Object Instantiate(Object original, Vector3 position, Quaternion rotation)
    {
        Object obj = Object.Instantiate(original, position, rotation);

#if NEED_COUNTER
        if (obj != null)
        {
            U3DFuncWrap.Instance().AddStatisticsCount(obj.name);
        }
#endif
        return(obj);
    }
예제 #3
0
    public static Object Instantiate(Object original)
    {
        Object obj = null;

        if (original != null)
        {
            obj = Object.Instantiate(original);
        }
#if NEED_COUNTER
        if (obj != null)
        {
            U3DFuncWrap.Instance().AddStatisticsCount(obj.name);
        }
#endif

        return(obj);
    }
예제 #4
0
    public void OnDebugCmd(string cmd)
    {
        if (cmd.Contains("navmesh "))
        {
            NavMeshRenderer.Instance.OnDebugCmd(cmd);
        }
        else if (cmd.Contains("lightregion ") || cmd.Contains("regionset ") || cmd.Contains("obstacleset "))
        {
            MapRegionRenderer.Instance.OnDebugCmd(cmd);
        }
        else if (cmd.Contains("dn "))
        {
            ScenesManager.Instance.OnDebugCmd(cmd);
        }
        else if (cmd == "count")
        {
            U3DFuncWrap.Instance().OnDebugCmd(cmd);
        }
        else if (cmd == "abcount")
        {
        }
        else if (cmd.Contains("logtimer"))
        {
            HobaDebuger.LogWarningFormat("Timer Count: {0}", _TimerList.GetTimerCount());
            for (int i = 0; i < _TimerList.GetTimerCount(); ++i)
            {
                var tm = _TimerList.GetTimer(i);
                HobaDebuger.LogWarningFormat("Id:{0}, ttl:{1}, once:{2}, debug:{3}", tm.Id, tm.TTL, tm.IsOnce, tm.DebugInfo);
            }

            HobaDebuger.LogWarningFormat("Late Timer Count: {0}", _LateTimerList.GetTimerCount());
            for (int i = 0; i < _LateTimerList.GetTimerCount(); ++i)
            {
                var tm = _LateTimerList.GetTimer(i);
                HobaDebuger.LogWarningFormat("Id:{0}, ttl:{1}, once:{2}, debug:{3}", tm.Id, tm.TTL, tm.IsOnce, tm.DebugInfo);
            }
        }
        else if (cmd.Contains("showui "))
        {
            string[] result = cmd.Split(' ');
            if (result == null || result.GetLength(0) < 2)
            {
                return;
            }

            if (result[0].Equals("showui"))
            {
                if (_CmdTransform == null)
                {
                    _CmdTransform = Main.PanelRoot.Find("UI_Debug(Clone)") as RectTransform;
                }
                //if (cmdTransform == null)
                //    cmdTransform = Main.TopPateCanvas.Find("UI_Debug(Clone)") as RectTransform;

                if (_LogTransform == null)
                {
                    _LogTransform = Main.PanelRoot.Find("UI_Log(Clone)") as RectTransform;
                }
                //if (logTransform == null)
                //    logTransform = Main.TopPateCanvas.Find("UI_Log(Clone)") as RectTransform;

                if (_SkillSlotTransform == null)
                {
                    _SkillSlotTransform = Main.PanelRoot.Find("Panel_Main_SkillNew(Clone)") as RectTransform;
                }
                if (_UIHeadTransform == null)
                {
                    _UIHeadTransform = Main.PanelRoot.Find("UI_Head(Clone)") as RectTransform;
                }
                if (result[1].Equals("0"))
                {
                    if (_CmdTransform != null)
                    {
                        _CmdTransform.SetParent(Main.UIRootCanvas);
                    }
                    if (_LogTransform != null)
                    {
                        _LogTransform.SetParent(Main.UIRootCanvas);
                    }

                    if (_SkillSlotTransform != null)
                    {
                        _SkillSlotTransform.gameObject.SetActive(false);
                    }

                    if (_UIHeadTransform != null)
                    {
                        _UIHeadTransform.gameObject.SetActive(false);
                    }

                    Main.PanelRoot.gameObject.transform.localScale = Vector3.zero;
                    Main.PanelHUD.gameObject.SetActive(false);
                    Main.TopPateCanvas.gameObject.SetActive(false);
                }
                else
                {
                    Main.PanelRoot.gameObject.transform.localScale = Vector3.one;
                    Main.PanelHUD.gameObject.SetActive(true);
                    Main.TopPateCanvas.gameObject.SetActive(true);

                    if (_CmdTransform != null)
                    {
                        _CmdTransform.SetParent(Main.PanelRoot);
                    }
                    if (_LogTransform != null)
                    {
                        _LogTransform.SetParent(Main.PanelRoot);
                    }
                    if (_SkillSlotTransform != null)
                    {
                        _SkillSlotTransform.gameObject.SetActive(true);
                    }
                    if (_UIHeadTransform != null)
                    {
                        _UIHeadTransform.gameObject.SetActive(true);
                    }
                }
            }
        }
        else if (cmd.Contains("perfs "))
        {
            string[] result = cmd.Split(' ');
            if (result == null || result.GetLength(0) < 3)
            {
                return;
            }

            if (result[0].Equals("perfs"))
            {
                int opt;
                if (int.TryParse(result[1], out opt))
                {
                    bool enable = !result[2].Equals("0");
                    switch (opt)
                    {
                    case 1:
                        DebugOptionShowTerrain = enable;
                        ShowTerrain();
                        break;

                    case 2:
                        DebugOptionShowBlocks = enable;
                        ShowBlocks(); break;

                    case 3:
                        DebugOptionShowFx = enable;
                        ShowFx(); break;

                    case 4:
                        DebugOptionShowProjector = enable;
                        break;

                    default: break;
                    }
                }
            }
        }
        else if (cmd.Contains("postprocess "))
        {
            string[] result = cmd.Split(' ');
            if (result == null || result.GetLength(0) < 2)
            {
                return;
            }

            if (result[0].Equals("postprocess"))
            {
                if (result[1].Equals("0"))
                {
                    Camera           cam   = Main.Main3DCamera;
                    PostProcessChain chain = null;
                    if (cam != null)
                    {
                        chain = cam.GetComponent <PostProcessChain>();
                    }
                    if (chain != null)
                    {
                        chain.enabled = false;
                    }
                }
                else
                {
                    Camera           cam   = Main.Main3DCamera;
                    PostProcessChain chain = null;
                    if (cam != null)
                    {
                        chain = cam.GetComponent <PostProcessChain>();
                    }
                    if (chain != null)
                    {
                        chain.enabled = true;
                    }
                }
            }
        }
        else if (cmd.Contains("errormessage "))
        {
            string[] result = cmd.Split(' ');
            if (result == null || result.GetLength(0) < 2)
            {
                return;
            }

            if (result[0].Equals("errormessage"))
            {
                int id = 0;
                if (int.TryParse(result[1], out id))
                {
                    StartCoroutine(ShowErrorMessage(id));
                }
            }
        }
    }