Exemple #1
0
        /// <summary>
        /// 加载一个Item
        /// </summary>
        public UIItem UF_CreateItem(string itemName)
        {
            UIItem uiitem = CEntitySystem.UF_GetInstance().UF_Create <UIItem> (itemName);

            if (uiitem == null)
            {
                Debugger.UF_Error(string.Format("This UIItem[ {0} ] you want to create is Null", itemName));
            }
            return(uiitem);
        }
Exemple #2
0
 private void UF_GetAllActiveFXController(List <FXController> list)
 {
     CEntitySystem.UF_GetInstance().UF_Select(
         (e) => {
         if (e is FXController)
         {
             list.Add(e as FXController);
         }
         return(false);
     }
         );
 }
Exemple #3
0
        private UIView UF_CreateView(string viewname)
        {
            UIView view = CEntitySystem.UF_GetInstance().UF_CreateFromPool(viewname) as UIView;

            if (view == null)
            {
                view = AssetSystem.UF_LoadComponentFromResources <UIView>("Prefabs/" + viewname);
                CEntitySystem.UF_GetInstance().UF_AddToActivity(view);
            }
            if (view != null)
            {
                UIManager.UF_GetInstance().UF_AddToCanvas("UI System", view);
            }
            return(view);
        }
Exemple #4
0
        public void UF_Play(string audioName)
        {
            if (string.IsNullOrEmpty(audioName))
            {
                return;
            }
            AudioController controller = UF_Find(audioName);

            if (controller != null)
            {
                controller.UF_Play();
                return;
            }
            //异步创建音频实体
            CEntitySystem.UF_GetInstance().UF_AsyncCreate(audioName, UF_EventAudioLoadFinish);
        }
Exemple #5
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 #6
0
        /// <summary>
        /// 同步显示界面
        /// </summary>
        public UIView UF_SyncShowView(string canvas, string viewName)
        {
            UIView view = UF_GetView(viewName);

            if (view == null)
            {
                view = CEntitySystem.UF_GetInstance().UF_Create <UIView>(viewName);
            }
            if (view != null)
            {
                UF_AddView(canvas, view);
            }
            else
            {
                Debugger.UF_Error(string.Format("Sync Show View {0}] Failed !", viewName));
            }
            return(view);
        }
Exemple #7
0
        IEnumerator UF_CoGameReboot()
        {
            Debugger.UF_Log("GameMain Reboot Begain");
            yield return(null);

            FrameHandle.UF_OnReset();
            yield return(null);

            CEntitySystem.UF_GetInstance().UF_ClearAll();
            yield return(null);

            AssetSystem.UF_GetInstance().UF_ClearAll(true);
            Debugger.UF_Log("GameMain Reboot Over");
            yield return(null);

            System.GC.Collect();
            yield return(null);

            UF_GameStart();
        }
Exemple #8
0
        public FXController UF_Create(string name)
        {
            if (UF_CheckInvalidName(name))
            {
                return(null);
            }
            FXController fx = CEntitySystem.UF_GetInstance().UF_Create <FXController> (name);

            if (fx != null)
            {
                UF_AddToFXRoot(fx);
                fx.UF_SetActive(true);
                //fx.FollowTo (null);
            }
            else
            {
                Debugger.UF_Warn(string.Format("Can not create fx:{0}", name));
            }
            return(fx);
        }
Exemple #9
0
        /// <summary>
        /// 异步显示界面,加入到指定Canvas中
        /// </summary>
        public int UF_ShowView(string canvas, string viewName, DelegateObject callback)
        {
            UIView value = UF_GetView(viewName);

            if (value != null)
            {
                UF_AddView(canvas, value);
                return(0);
            }
            else
            {
                if (m_MarkViewInLoad.Contains(viewName))
                {
                    Debugger.UF_Error(string.Format("View[{0}] is in Loading,can not load twince!", viewName));
                    return(0);
                }
                else
                {
                    m_MarkViewInLoad.Add(viewName);
                }

                return(CEntitySystem.UF_GetInstance().UF_AsyncCreate(viewName,
                                                                     (e) => {
                    m_MarkViewInLoad.Remove(viewName);
                    UIView view = e as UIView;
                    if (view != null)
                    {
                        UF_AddView(canvas, view);
                    }
                    else
                    {
                        Debugger.UF_Error(string.Format("ASync Show View {0}] Failed !", viewName));
                    }
                    if (callback != null)
                    {
                        callback(view);
                    }
                }
                                                                     ));
            }
        }
Exemple #10
0
        //载入布局
        public void UF_LoadSceneElementLayout(string dataName)
        {
            UF_ClearSceneElement();
            //var layoutData =  AssetSystem.UF_GetInstance().LoadObjectImageComponent<SecenElementLayout>(dataName);
            AssetSceneLayout layoutData = RefObjectManager.UF_GetInstance().UF_LoadRefObject <AssetSceneLayout>(dataName, false) as AssetSceneLayout;

            if (layoutData != null)
            {
                foreach (var item in layoutData.Data)
                {
                    if (!string.IsNullOrEmpty(item.block))
                    {
                        var element = CEntitySystem.UF_GetInstance().UF_Create <SceneElement>(item.block);
                        if (element != null)
                        {
                            this.UF_AddSceneElement(element, item.x, item.y);
                            //寻路相关值设置
                            UF_SetASGridBlockStateArea(element, item.x, item.y);
                        }
                    }
                }
            }
        }
Exemple #11
0
        public UIView UF_SyncShow(string contentName)
        {
            if (string.IsNullOrEmpty(contentName))
            {
                Debugger.UF_Error(string.Format("UIContent SyncShow Failed! contentName is Null"));
                return(null);
            }

            if (m_Content != null && m_Content.name == contentName)
            {
                m_IsClosed = false;
                m_Content.UF_SetActive(true);
                MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_UI_SHOW, m_Content);
                return(m_Content);
            }

            if (m_Content != null && m_Content.name != contentName)
            {
                this.UF_Close();
            }

            m_Content = CEntitySystem.UF_GetInstance().UF_Create(contentName) as UIView;

            if (m_Content != null)
            {
                m_IsClosed = false;
                m_Content.UF_SetActive(true);
                UF_AddToContent(m_Content);
                MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_UI_SHOW, m_Content);
                return(m_Content);
            }
            else
            {
                Debugger.UF_Warn(string.Format("UIContent SyncShow Failed! Can not load View[{0}]", contentName));
                return(null);
            }
        }
Exemple #12
0
        private void UF_AsyncShow(string contentName, DelegateObject callback)
        {
            if (m_IsLoadProcess)
            {
                Debugger.UF_Error(string.Format("UIContent AsyncShow Failed! Content[{0}] is in loading!", contentName));
                return;
            }
            m_IsLoadProcess = true;

            try
            {
                CEntitySystem.UF_GetInstance().UF_AsyncCreate(contentName,
                                                              (entity) =>
                {
                    m_IsLoadProcess = false;
                    if (entity != null)
                    {
                        if (m_IsClosed)
                        {
                            (entity as IEntityHnadle).isReleased = true;
                            return;
                        }
                        else
                        {
                            UF_AddToContent(entity as UIView);
                            GHelper.UF_SafeCallDelegate(callback, this);
                            MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_UI_SHOW, this);
                        }
                    }
                }
                                                              );
            }
            catch (System.Exception e) {
                Debugger.UF_Error("UIContent AstncShow Exception:");
                Debugger.UF_Exception(e);
            }
        }
Exemple #13
0
        protected bool UF_PlayTriggerDip()
        {
            if (!m_IsPlaying)
            {
                return(false);
            }
            DipController tDip = null;

            if (!string.IsNullOrEmpty(triggerDip))
            {
                tDip = CEntitySystem.UF_GetInstance().UF_Create <DipController>(triggerDip);
            }
            if (tDip != null)
            {
                //碰撞事件由触发弹道处理,触发弹道继承原弹道所有参数属性
                tDip.uptr     = this.uptr;
                tDip.ower     = this.ower;
                tDip.position = this.position;
                tDip.euler    = this.euler;
                tDip.eLayer   = this.eLayer;
                //拷贝参数
                if (m_Parameters != null)
                {
                    foreach (var item in parameters)
                    {
                        tDip.UF_SetParam(item.Key, item.Value);
                    }
                }
                //设置触发弹道父类
                tDip.UF_SetParam("parent", this.name);
                tDip.UF_SetParam("parent_id", this.id.ToString());

                tDip.UF_Play(m_Target, m_TarPos, m_Forward);
                return(true);
            }
            return(false);
        }
Exemple #14
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));
            }
        }