Example #1
0
        /// <summary>
        /// 加载指定名称的“UI窗体”
        /// 功能:
        ///    1:根据“UI窗体名称”,加载预设克隆体。
        ///    2:根据不同预设克隆体中带的脚本中不同的“位置信息”,加载到“根窗体”下不同的节点。
        ///    3:隐藏刚创建的UI克隆体。
        ///    4:把克隆体,加入到“所有UI窗体”(缓存)集合中。
        /// </summary>
        private UIBase LoadUIForm(string uiFormName)
        {
            string     strUIFormPaths   = null;           //UI窗体路径
            GameObject goCloneUIPrefabs = null;           //创建的UI克隆体预设
            UIBase     baseUiForm       = null;           //窗体基类


            //根据UI窗体名称,得到对应的加载路径
            _DicFormsPaths.TryGetValue(uiFormName, out strUIFormPaths);

            Debug.Log(strUIFormPaths);

            //根据“UI窗体名称”,加载“预设克隆体”
            if (!string.IsNullOrEmpty(strUIFormPaths))
            {
                goCloneUIPrefabs = ResourcesMgr.Instance().LoadAsset(strUIFormPaths, false);
            }

            //设置“UI克隆体”的父节点(根据克隆体中带的脚本中不同的“位置信息”)
            if (_TraCanvasTransfrom != null && goCloneUIPrefabs != null)
            {
                baseUiForm = goCloneUIPrefabs.GetComponent <UIBase>();
                if (baseUiForm == null)
                {
                    Debug.Log("baseUiForm==null! ,请先确认窗体预设对象上是否加载了baseUIForm的子类脚本! 参数 uiFormName=" + uiFormName);
                    return(null);
                }
                switch (baseUiForm.CurrentUIType.UIForms_Type)
                {
                case UIFormType.Normal:     //普通窗体节点
                    goCloneUIPrefabs.transform.SetParent(_TraNormal, false);
                    break;

                case UIFormType.Fixed:     //固定窗体节点
                    goCloneUIPrefabs.transform.SetParent(_TraFixed, false);
                    break;

                case UIFormType.PopUp:     //弹出窗体节点
                    goCloneUIPrefabs.transform.SetParent(_TraPopUp, false);
                    break;

                default:
                    break;
                }

                //设置隐藏
                goCloneUIPrefabs.SetActive(false);
                //把克隆体,加入到“所有UI窗体”(缓存)集合中。
                _DicALLUIForms.Add(uiFormName, baseUiForm);

                return(baseUiForm);
            }
            else
            {
                Debug.Log("_TraCanvasTransfrom==null Or goCloneUIPrefabs==null!! ,Plese Check!, 参数uiFormName=" + uiFormName);
            }

            Debug.Log("出现不可以预估的错误,请检查,参数 uiFormName=" + uiFormName);
            return(null);
        }//Mehtod_end
Example #2
0
        /// <summary>
        /// 粒子特效加载公共方法
        /// </summary>
        /// <param name="internalTime"></param>
        /// <param name="strParticalEffectPath">粒子特效路径</param>
        /// <param name="IsUseCache">是否使用缓存</param>
        /// <param name="particalEffectPosition">粒子特效方位</param>
        /// <param name="tranParent"></param>
        /// <param name="strAudioEffect"></param>
        /// <param name="destroyTime"></param>
        /// <returns></returns>
        protected IEnumerator LoadParticalEffectPublicMethod(float internalTime, string strParticalEffectPath, bool IsUseCache,
                                                             Vector3 particalEffectPosition, Transform tranParent, string strAudioEffect = null, float destroyTime = 0)
        {
            //间隔时间
            yield return(new WaitForSeconds(internalTime));

            //提取的粒子预设
            GameObject goParticalPrefab = ResourcesMgr.GetInstance().LoadAsset(strParticalEffectPath, IsUseCache);

            //粒子预设的位置
            goParticalPrefab.transform.position = particalEffectPosition;
            //父子对象
            if (tranParent != null)
            {
                goParticalPrefab.transform.parent = tranParent;
            }
            //特效音频
            if (!string.IsNullOrEmpty(strAudioEffect))
            {
                AudioManager.PlayAudioEffectA(strAudioEffect);
            }
            //销毁时间
            if (destroyTime > 0)
            {
                Destroy(goParticalPrefab, destroyTime);
            }
        }
Example #3
0
    /// <summary>
    /// 加载指定名字的“UI窗口”
    /// 1.根据“UI窗口”的名称,加载预制克隆
    /// 2.根据不同预制克隆体带的脚本中不同的“位置信息”,加载到“根窗体”下的不同节点
    /// 3.隐藏创建的UI克隆体
    /// 4.把克隆加入到“所有UI窗体”(缓存)集合中
    /// </summary>
    /// <param name="uriFormName"></param>
    /// <returns></returns>
    private BaseUIForm LoadUIForm(string uriFormName)
    {
        Debug.Log("LoadUIForm:" + uriFormName);
        string     strUIFormPath    = null;                                       //UI窗体的路径
        GameObject goCloneUIPrefabs = null;                                       //创建的UI窗体克隆
        BaseUIForm baseUIForm       = null;                                       //窗体基类

        //根据UI窗体名称,得到对应的加载路径
        _dicFormsPaths.TryGetValue(uriFormName, out strUIFormPath);

        //根据“UI窗体”名称,加载预制克隆体
        if (!string.IsNullOrEmpty(strUIFormPath))
        {
            goCloneUIPrefabs = ResourcesMgr.GetInstance().LoadAsset(strUIFormPath, false);
        }
        else
        {
            Debug.LogError("JSON中未定义的窗口");
        }

        //根据克隆体中带的脚本中的不同信息,设计Ui克隆的父节点
        if (_traCanvasTransform != null && goCloneUIPrefabs != null)
        {
            baseUIForm = goCloneUIPrefabs.GetComponent <BaseUIForm>();
            if (baseUIForm == null)
            {
                Debug.LogError("JSON定义的路径找不到窗口预制");
                return(null);
            }
            switch (baseUIForm.CurrentUIType.UIForm_Type)
            {
            case UIFormType.Normal:     //普通窗体
                goCloneUIPrefabs.transform.SetParent(_traNormal, false);
                break;

            case UIFormType.Fixed:      //固定窗体
                goCloneUIPrefabs.transform.SetParent(_traFixed, false);
                break;

            case UIFormType.Popup:      //弹出窗体
                goCloneUIPrefabs.transform.SetParent(_traPopUp, false);
                break;

            default:
                break;
            }
            //隐藏克隆
            goCloneUIPrefabs.SetActive(false);
            //加入克隆到“所有UI窗体(缓存)”集合中
            _dicAllUIForms.Add(uriFormName, baseUIForm);
            return(baseUIForm);
        }
        else
        {
            Debug.Log("_traCanvasTransform == null OR goCloneUIPrefab == null, uriFormName = " + uriFormName);
        }
        Debug.Log("Unkown, uriFormName = " + uriFormName);
        return(null);
    }
        //主角升级
        private void HeroLevelUp()
        {
            //提取升级粒子预设
            GameObject HeroLevelUp = ResourcesMgr.GetInstance().LoadAsset("ParticleProps/Hero_LvUp", true);

            //音效
            AudioManager.PlayAudioEffectA("LevelUp");
        }
 void OnCheckABResourceCallback(bool isfinish)
 {
     Debug.Log("OnCheckABResourceCallback  isfinish=" + isfinish);
     if (isfinish)
     {
         ResourcesMgr.GetInstance();
     }
 }
    private Hashtable ht = null;                            //容器键值对集合

    /// <summary>
    /// 得到实例(单例)
    /// </summary>
    /// <returns></returns>
    public static ResourcesMgr GetInstance()
    {
        if (_Instance == null)
        {
            _Instance = new GameObject("_ResourceMgr").AddComponent <ResourcesMgr>();
        }
        return(_Instance);
    }
Example #7
0
        /// <summary>
        /// 根据类型和路径返回相应的资源(异步方法)
        /// </summary>
        /// <param name="path"></param>
        /// <param name="t"></param>
        public static void LoadAsync(string path, Type type, Action <Object, string> callback)
        {
#if UNITY_EDITOR && !SIMULATE_MODE
            Debug.LogError("This Function is not implement in UnityEditor!");
#else
            ResourcesMgr.GetInstance().LoadAsync(path, type, callback);
#endif
        }
Example #8
0
 public static ResourcesMgr GetInstance()
 {
     if (null == instance)
     {
         instance = new ResourcesMgr();
     }
     return(instance);
 }
 public void SetSelet(string path)
 {
     if (isSelect)
     {
         GameObject item = ResourcesMgr.GetInstance().LoadAsset(path, true);
         SetSelet(item);
     }
 }
Example #10
0
    /// <summary>
    /// 设置关卡,初始化图块数据
    /// </summary>
    /// <param name="level"></param>
    public void SetLevel(int level)
    {
        curLevel = level;
        string path = MAP_PATH + level;

        curMap = ResourcesMgr.Instance().LoadAsset(path, true);
        TiledMap map = curMap.GetComponent <TiledMap>();

        InitMapNode(map);
    }
Example #11
0
    /// <summary>
    /// 加载指定名称UI窗体
    /// 功能:
    ///     1.根据“UI窗体枚举”,加载预设克隆体
    ///     2.根据不同预设克隆体中带的脚本中不同的“位置信息”,加载到根窗体下不同的节点
    ///     3.隐藏刚创建的UI克隆体
    ///     4.把克隆体加入到所有UI窗体的缓存集合中
    /// </summary>
    /// <param name="winType">UI窗体枚举</param>
    /// <returns></returns>
    private BaseUIForms LoadUIForm(EM_WinType winType)
    {
        string      strUIFormPath   = null; //UI窗体的查询路径
        GameObject  goCloneUIPrefab = null; //创建的UI克隆体
        BaseUIForms baseUiForms     = null; //窗体基类

        //根据UI窗体名称,得到对应的加载路径
        _DictionaryPaths.TryGetValue(winType, out strUIFormPath);


        //根据UI窗体名称,加载预设克隆体
        if (!string.IsNullOrEmpty(strUIFormPath))
        {
            goCloneUIPrefab = ResourcesMgr.GetInstance().LoadAsset(strUIFormPath, false);
        }
        else
        {
            LogMgr.GetInstance().Log(LogEnum.Error, "加载UI窗体出错,没有找到" + winType.ToString() + "窗口的路径");
            return(null);
        }

        //设置UI克隆体的父节点  根据克隆体中带的脚本中不同的“位置信息”
        if (_TraCanvasTranform != null && goCloneUIPrefab != null)
        {
            baseUiForms = goCloneUIPrefab.GetComponent <BaseUIForms>();        //得到这个克隆体里面的BaseUIForms脚本

            if (baseUiForms == null)
            {
                LogMgr.GetInstance().Log(LogEnum.Error, "baseUIForms为空,请先确认窗体预设对象是否已经加载了子类脚本,UIFormName=" + winType.ToString());
                return(null);
            }

            if (baseUiForms.GetUIType() == UIFormType.Full)
            {
                goCloneUIPrefab.transform.SetParent(_TraNormal, false);
            }
            else if (baseUiForms.GetUIType() == UIFormType.PopUp)
            {
                goCloneUIPrefab.transform.SetParent(_TraPopUp, false);
            }

            //设置隐藏   初始时应该是隐藏的,因为不知道需不需要一开始就显示
            goCloneUIPrefab.SetActive(false);

            //把克隆体加入到所有UI窗体缓存集合中
            if (!_DicAllUiFormses.ContainsKey(winType))
            {
                _DicAllUiFormses.Add(winType, baseUiForms);
            }

            return(baseUiForms);
        }

        return(null);
    }
Example #12
0
    /// <summary>
    /// 拖动过程中刷新UI
    /// </summary>
    void RefreshUI()
    {
        int needCount = Recyle.Instance().pathList.Count;

        //判断向上还是向下
        if (curPos.y > beginPos.y)
        {
            //Debug.Log("向下");
            if (curTail >= needCount - 1)
            {
                return;
            }
            int count = curPool.Count;
            int idx   = 0;
            for (int i = 0; i < count; i++)
            {
                if (curPos.y + curPool[idx].transform.localPosition.y >= 0)
                {
                    GameObject go = curPool[idx];
                    curPool.RemoveAt(idx);
                    ResourcesMgr.Instance().PushPool(PrefabDefine.RECORD, go);
                    AddItemInGrid(++curTail);
                }
                else
                {
                    return;
                }
            }
        }
        else if (curPos.y < beginPos.y)
        {
            //Debug.Log("向上");
            if (curHead <= 0)
            {
                return;
            }
            int   count  = curPool.Count;
            int   idx    = count - 1;
            float height = view.GetComponent <RectTransform>().sizeDelta.y;
            for (int i = count - 1; i >= 0; i--)
            {
                if (curPos.y + height + curPool[idx].transform.localPosition.y < cellSize.y)
                {
                    GameObject go = curPool[idx];
                    curPool.RemoveAt(idx);
                    ResourcesMgr.Instance().PushPool(PrefabDefine.RECORD, go);
                    AddItemInGrid(--curHead, false);
                }
                else
                {
                    return;
                }
            }
        }
    }
Example #13
0
    public void InitData(ResourcesMgr res)
    {
        this.Asset   = res.Asset;
        this.Name    = res.UIName;
        this.ui_mgr  = res.UIMgr;
        this.context = res.Args;
        this.Canvas  = GetControl <Canvas>(this.gameObject);

        CanvasControl();
        Show();
    }
Example #14
0
 /// <summary>
 /// 初始化皮肤
 /// </summary>
 protected virtual void OnInitSkin()
 {
     if (!string.IsNullOrEmpty(mainSkinPath))
     {
         _skin = ResourcesMgr.GetInstance().CreateGameObject(mainSkinPath, false);
     }
     _skin.transform.parent           = this.transform;
     _skin.transform.localEulerAngles = Vector3.zero;
     _skin.transform.localScale       = Vector3.one;
     _skin.transform.localPosition    = Vector3.zero;
 }
Example #15
0
    public void Init(GuestType guestType, ItemType itemType, int numQueue)
    {
        GuestUI_Item();

        _type               = guestType;
        _requiredItem       = itemType;
        _numOrder           = numQueue;
        _guestSprite.sprite = ResourcesMgr.GetSprite(GetGuestSpriteName(guestType));

        anim.Play("GuestMoveIn");
    }
Example #16
0
        /// <summary>
        /// 初始化游戏核心
        /// </summary>
        public void InitGameCore(GameObject gameObject)
        {
            //初始化各种管理器
            resourceMgr = ResourcesMgr.GetInstance();

            gameLauncherObj = gameObject;
            sceneMgr        = gameObject.AddComponent <SceneMgr>();
            audioManager    = AudioManager.Instance;
            inputMgr        = gameLauncherObj.AddComponent <InputMgr>();

            GameStart();
        }
Example #17
0
    /// <summary>
    /// 初始化光标,定义初始位置跟idx,添加到鼠标移动事件
    /// </summary>
    private void InitMouseCursor()
    {
        GameObject prefab = ResourcesMgr.Instance().LoadResource <GameObject>(NORMALCURSOR_PATH, true);

        mouseCursor = Instantiate <GameObject>(prefab);
        //Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        //pos.z = 0;
        //mouseCursor.transform.position = pos;
        //cursorIdx = Pos2Idx(pos);
        cursorIdx = HeroManager.Instance().GetHero(0).mID;
        mouseCursor.transform.position = Idx2Pos(cursorIdx);
        cursorAnimator = mouseCursor.GetComponent <Animator>();
    }
Example #18
0
    void logout()
    {
        ReplayMgr rm   = ReplayMgr.GetInstance();
        GameMgr   gm   = GameMgr.GetInstance();
        RoomMgr   room = RoomMgr.GetInstance();

        ResourcesMgr.GetInstance().release();

        rm.clear();
        gm.Reset();
        room.reset();
        LoadingScene.LoadNewScene("01.login");
    }
 private void ShowAssetUpdateUI()
 {
     ResourcesMgr.GetInstance().LoadResourcesAsset("Prefabs/UI/TestAssetUpdatePanel", (go) =>
     {
         if (go == null)
         {
             Debug.LogError("ShowAssetUpdateUI  Fail,Not Exit");
             return;
         }
         GameObject uiPrefab     = GameObject.Instantiate(go) as GameObject;
         m_UITestAssetUpdateView = uiPrefab.GetAddComponent <UITestAssetUpdateView>();
     });
 }
    public void Test()
    {
        gameObject.SetActive(true);
        //ResourcesMgr.GetInstance().LoadSprite("Texture/SelfIcon", (obj) =>
        //{
        //    m_img.sprite = obj as Sprite;
        //});

        ResourcesMgr.GetInstance().LoadAsset("Localization_Sprite/cn/Main/icon_shangdian", (obj) =>
        {
            m_img.sprite = (obj as GameObject).GetComponent <SpriteRenderer>().sprite;
        });
    }
Example #21
0
 /// <summary>
 /// 打开遮罩面板
 /// </summary>
 /// <param name="screen">遮罩所需的参数,会根据param来设置关联的页面</param>
 public void Show(ScreenBase screen)
 {
     if (goAutoMask == null)
     {
         ResourcesMgr.GetInstance().LoadAsset <GameObject>("UIAutoMask", (ao) => {
             goAutoMask = ao;
             AttachEvent(screen);
         });
     }
     else
     {
         AttachEvent(screen);
     }
 }
Example #22
0
    public void CreatePanel <T>(string path) where T : UIBase
    {
        GameObject ass = ResourcesMgr.GetAsset <GameObject>(path);
        GameObject go  = GameObject.Instantiate(ass);

        go.AddComponent <T>();
        go.transform.SetParent(uiCanvas.transform);
        RectTransform rt = go.transform as RectTransform;

        rt.localPosition = Vector3.zero;
        rt.localScale    = Vector3.one;
        rt.sizeDelta     = Vector2.zero;
        go.name          = typeof(T).ToString();
    }
Example #23
0
    void onGameSync()
    {
        ResourcesMgr.GetInstance().StopAllHands();

        DHM_CardManager[] cms = PlayerManager.GetInstance().getCardManagers();
        foreach (DHM_CardManager cm in cms)
        {
            cm.sync();
        }

        RoomMgr rm = RoomMgr.GetInstance();

        InteractMgr.GetInstance().checkChuPai(rm.isMyTurn());
    }
Example #24
0
    /// <summary>
    /// 加载指定名称的“UI窗体”
    /// 功能:
    ///    1:根据“UI窗体名称”,加载预设克隆体。
    ///    2:根据不同预设克隆体中带的脚本中不同的“位置信息”,加载到“根窗体”下不同的节点。
    ///    3:隐藏刚创建的UI克隆体。
    ///    4:把克隆体,加入到“所有UI窗体”(缓存)集合中。
    /// </summary>
    /// <param name="uiFormName">UI窗体名称</param>
    private BaseUiFrame LoadUiForm(string uiFormName)
    {
        GameObject cloneUiPrefabs = null;             //创建的UI克隆体预设
        UiWind     uiWind         = (UiWind)Enum.Parse(typeof(UiWind), uiFormName);

        //根据UI窗体名称,得到对应的加载路径
        _dicFormsPaths.TryGetValue(uiWind, out string strUiFormPaths);
        //根据“UI窗体名称”,加载“预设克隆体”
        if (strUiFormPaths != null)
        {
            cloneUiPrefabs = ResourcesMgr.Instance().LoadAsset(strUiFormPaths, false);
        }
        //设置“UI克隆体”的父节点(根据克隆体中带的脚本中不同的“位置信息”)
        if (CanvasTrans != null && cloneUiPrefabs != null)
        {
            BaseUiFrame baseUiForm = cloneUiPrefabs.GetComponent <BaseUiFrame>();   //窗体基类
            if (baseUiForm == null)
            {
                Debug.Log("baseUiForm==null! ,请先确认窗体预设对象上是否加载了baseUIForm的子类脚本! 参数 uiFormName=" + uiFormName);
                return(null);
            }
            switch (baseUiForm.CurrentUiType.UiWindType)
            {
            case UiWindType.Normal:                     //普通窗体节点
                cloneUiPrefabs.transform.SetParent(_normalTrans, false);
                break;

            case UiWindType.Fixed:                      //固定窗体节点
                cloneUiPrefabs.transform.SetParent(_fixedTrans, false);
                break;

            case UiWindType.PopUp:                      //弹出窗体节点
                cloneUiPrefabs.transform.SetParent(_popUpTrans, false);
                break;
            }
            //设置隐藏
            cloneUiPrefabs.SetActive(false);
            //把克隆体,加入到“所有UI窗体”(缓存)集合中。
            _dicAllUiForms.Add(uiFormName, baseUiForm);
            return(baseUiForm);
        }
        else
        {
            Debug.Log("_TraCanvasTransfrom==null Or goCloneUIPrefabs==null!! ,Plese Check!, 参数uiFormName=" + uiFormName);
        }

        Debug.Log("出现不可以预估的错误,请检查,参数 uiFormName=" + uiFormName);
        return(null);
    }
Example #25
0
    private void GameMgrInit()
    {
        instance = this;
        var audioSystem = GameObject.Find("AudioSystem").gameObject;

        DontDestroyOnLoad(this);
        DontDestroyOnLoad(Camera.main);
        DontDestroyOnLoad(UIManager.Instance.UiRoot);
        DontDestroyOnLoad(audioSystem);
        msgHandleDic          = new Dictionary <MsgNoS2C, List <MsgHandlerFun> >();
        msgWithIndexHandleDic = new Dictionary <MsgNoS2C, List <MsgWithIndexHandlerFun> >();
        ApplicationFacade.Instance.RegisterMediator(new GameMgrMediator(Mediators.GAMEMGR_MEDIATOR, this));
        ResourcesMgr resMgr = ResourcesMgr.Instance;

        this.InitPrefsKey();
    }
Example #26
0
    public RawImage BG; // 背景

    public override void Awake()
    {
        base.Awake();

        ResMgr = system_mgr.GetSingleT <ResourcesMgr>();
        NetMgr = system_mgr.GetSingleT <NetMgr>();

        Root      = (GameObject)Resources.Load(SysDefine.PrefabPath + "Root");// 获取根节点
        Root      = UnityEngine.Object.Instantiate(Root);
        Root.name = Root.name.Replace("(Clone)", "");
        UnityEngine.Object.DontDestroyOnLoad(Root);// 切换场景不销毁
        UICamera = Tool.FindChild <Camera>(Root.transform, "Camera");
        BG       = Tool.FindChild <RawImage>(Root.transform, "BGImg");

        FireEvent(new Events.UI.OpenUI("Start"));
    }
Example #27
0
    public GameObject CreatePengGangCard(int id, Vector3 pos, Quaternion q)
    {
        //GameObject obj = Instantiate(go, new Vector3(0, 0, 0), Quaternion.identity, pengGangArea) as GameObject;
        GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id);

        obj.transform.SetParent(pengGangArea);
        obj.transform.localPosition = pos;
        obj.transform.localRotation = q;

        //obj.GetComponent<HandCard> ().setID (id);
        //RuleManager.m_instance.UVoffSet(id,obj);

        AddToList(id, obj);
        obj.layer = LayerMask.NameToLayer("PengPai");
        return(obj);
    }
Example #28
0
    private void InitUI()
    {
        float viewHeight = view.GetComponent <RectTransform>().sizeDelta.y;

        cellSize = contentTrans.GetComponent <GridLayoutGroup>().cellSize;
        float cellHeight = cellSize.y;
        //view能容纳个数
        float count = viewHeight / cellHeight;
        //根据需要加载个数
        int needCount = Recyle.Instance().pathList.Count;

        //根据需要加载个数初始化contentsize
        contentTrans.GetComponent <RectTransform>().sizeDelta = new Vector2(0, needCount * cellHeight);
        if (count - (int)count > 0)
        {
            count = (int)count + 1;
        }
        //实际需要
        int realCount = 0;

        if (needCount >= (int)count)
        {
            realCount = (int)count;
        }
        else
        {
            realCount = needCount;
        }

        for (int i = 0; i < realCount; i++)
        {
            GameObject go = ResourcesMgr.Instance().PopPool(PrefabDefine.RECORD);
            go.name = "record_" + i;
            go.transform.SetParent(contentTrans);
            go.transform.localScale = Vector3.one;
            go.transform.Find("Text").GetComponent <Text>().text = Recyle.Instance().pathList[i];

            Button btn = go.GetComponent <Button>();
            btn.onClick.AddListener(delegate()
            {
                OnClickRecord(go);
            });
        }
        curHead = 0;
        curTail = (int)count - 1;
    }
Example #29
0
        public static void Init()
        {
            InitGameModule();

            ResourcesSystem.Init();
            //依赖
            ResourcesMgr.LoadManifest();
            ResourcesMgr.LoadBundleByType(EABType.Shader, "shaderCollect");
            //UI
            ResourcesMgr.LoadBundleByType(EABType.UI, "UIRoot");
            GameObject tmpUIRoot = Hotfix.Instantiate(ResourcesMgr.GetAssetByType <GameObject>(EABType.UI, "UIRoot"));

            GameObject.DontDestroyOnLoad(tmpUIRoot);
            CameraMgr.Instance.InitUICamera(tmpUIRoot);
            WindowsMgr.SetWindowsRoot(CameraMgr.Instance.UICanvasRootGo.transform);

            ////主相机
            ResourcesMgr.LoadBundleByType(EABType.Misc, "CameraControl");
            GameObject tmpMainCameraGo = Hotfix.Instantiate(ResourcesMgr.GetAssetByType <GameObject>(EABType.Misc, "CameraControl"));

            GameObject.DontDestroyOnLoad(tmpMainCameraGo);
            CameraMgr.Instance.InitMainCamera(tmpMainCameraGo);

            ////HUD相机
            ResourcesMgr.LoadBundleByType(EABType.Misc, "HUDRoot");
            GameObject tmpHudGo = ResourcesMgr.GetAssetByType <GameObject>(EABType.Misc, "HUDRoot");

            tmpHudGo = Hotfix.Instantiate(tmpHudGo);
            GameObject.DontDestroyOnLoad(tmpHudGo);
            CameraMgr.Instance.InitHudCamera(tmpHudGo);

            CameraActionMgr.Init(CameraMgr.Instance.MainCamera, CameraMgr.Instance.CloseupGo, CameraMgr.Instance.ShakeGo);

            LoadTbl();
            InitActionSystem();

            //流程
            ProcedureMgr.Initialize(FsmMgr);
            ProcedureMgr.AddProcedure <ProcedureCheckVersion>();
            ProcedureMgr.AddProcedure <ProcedureLogin>();
            ProcedureMgr.AddProcedure <ProcedureChangeScene>();
            ProcedureMgr.AddProcedure <ProcedureMain>();
            ProcedureMgr.AddProcedure <ProcedurePVE>();

            ProcedureMgr.StartProcedure <ProcedureMain>();
        }
Example #30
0
    void Start()
    {
        _MainCamera    = Camera.main.gameObject.GetComponent <Camera>();
        _UICamera      = GameObject.FindGameObjectWithTag("UICamera").GetComponent <Camera>();
        _EnemyProperty = gameObject.GetComponent <EnemyProperty>();

        //加载敌人血条
        _EnemyHPBar = ResourcesMgr.GetInstance().LoadAsset("Prefabs/UI/EnemyHPBar", true);
        _EnemyHPBar.transform.parent = GameObject.FindGameObjectWithTag("BattleSceneUI").transform;
        //血条尺寸
        _EnemyHPBar.transform.localScale = new Vector3(_EnemyHPBarLength, _EnemyHPBarHeight, 0);

        if (_EnemyHPBar != null)
        {
            _EnemyHPSlider = _EnemyHPBar.GetComponent <Slider>();
        }
    }