示例#1
0
    /*
     * void OnApplicationFocus(bool focusStatus) {
     * if (focusStatus) {
     *              if (!NetManager.Connected) {
     *                      NetManager.ReInit();
     *                      GameObject.DestroyImmediate(waitingParentT);
     *                      GameObject newAnchorObject = new GameObject("Anchor");
     *                      GameObject uiroot = GameObject.Find("UI Root (2D)");
     *                      newAnchorObject.transform.parent = uiroot.transform;
     *                      newAnchorObject.transform.localScale = Vector3.one;
     *                      UIAnchor anchor = newAnchorObject.AddComponent<UIAnchor>();
     *                      anchor.side = UIAnchor.Side.Center;
     *                      waitingParentT = newAnchorObject.transform;
     *                      StartCoroutine("_CreateLoginView");
     *              }
     *      }
     * }
     */

    void _LoadLinkBeforeLoad()        // 加载 主要管理类
    {
        m_NetMgr      = _CreateLink <NetMgr>();
        m_ProtocolMgr = _CreateLink <ProtocolMgr>();
        m_BundleMgr   = _CreateLink <BundleMgr>();
        m_MainPlayer  = _CreateLink <Player>();
    }
示例#2
0
    void Start()
    {
        luaMgr.Start();

        Object     guiPrefab = BundleMgr.LoadAsset("Prefabs/GUI.prefab");
        GameObject gui       = GameObject.Instantiate(guiPrefab) as GameObject;

        gui.name = "GUI";

        Object     guanyuPrefab = BundleMgr.LoadAsset("Prefabs/guanyu.prefab");
        GameObject guanyu       = GameObject.Instantiate(guanyuPrefab) as GameObject;

        guanyu.name = "guanyu";
        //guanyu.transform.SetParent(gui.transform);
        //guanyu.transform.localScale = new Vector3(1, 1, 1);

        Object     mainCityPanel = BundleMgr.LoadAsset("Prefabs/MainCity.prefab");
        GameObject mainCity      = GameObject.Instantiate(mainCityPanel) as GameObject;

        mainCity.name = "MainCity";
        mainCity.transform.SetParent(gui.transform);
        mainCity.transform.localScale = new Vector3(1, 1, 1);

        //BundleMgr.LoadAsyncAsset("Prefabs/MainCity.prefab", callback);
    }
示例#3
0
 void Awake()
 {
     bundleMgr = BundleMgr.Instance;
     bundleMgr.Init();
     levelMgr = LevelMgr.Instance;
     levelMgr.Init();
     gameMgr = GameMgr.Instance;
     gameMgr.Init();
     // Hide cursor
     Cursor.visible = false;
 }
示例#4
0
    // 开场动画
    public void ShowKaiChangGifView()
    {
        System.Action <Object> handler = (asset) => {
            if (asset != null)
            {
                GameObject gifView = (GameObject)GameObject.Instantiate(asset);
                NGUIUtility.SetParent(waitingParentT, gifView.transform);
            }
        };

        StartCoroutine(BundleMgr.CreateObject(kResource.View, "KaiChangView", "KaiChangView", handler));
    }
示例#5
0
 // 战斗结果
 public void ShowBattleRecordResultView(bool bresult, Data_MapBattle_R.SetData data)
 {
     System.Action <Object> handler = (asset) => {
         if (asset != null)
         {
             GameObject  resultViewObject = (GameObject)GameObject.Instantiate(asset);
             JiesuanView resultView       = resultViewObject.GetComponent <JiesuanView>();
             NGUIUtility.SetParent(waitingParentT, resultViewObject.transform);
             resultView.show(bresult, data);
         }
     };
     StartCoroutine(BundleMgr.CreateObject(kResource.View, "JiesuanView", "JiesuanView", handler));
 }
示例#6
0
 // 任务
 public void ShowRenwuView(MapJson mapjson)
 {
     System.Action <Object> handler = (asset) => {
         if (asset != null)
         {
             GameObject renwuViewObject = (GameObject)GameObject.Instantiate(asset);
             RenwuView  renwuView       = renwuViewObject.GetComponent <RenwuView>();
             renwuView.show(mapjson);
             NGUIUtility.SetParent(waitingParentT, renwuViewObject.transform);
         }
     };
     StartCoroutine(BundleMgr.CreateObject(kResource.View, "RenwuView", "RenwuView", handler));
 }
示例#7
0
 // 角色创建面板
 public void ShowCreateRoleView()
 {
     if (m_SelectRoleView == null)
     {
         System.Action <Object> handler = (asset) => {
             if (asset != null)
             {
                 GameObject selectRoleView = (GameObject)GameObject.Instantiate(asset);
                 m_SelectRoleView = selectRoleView.GetComponent <SelectRoleView>();
                 NGUIUtility.SetParent(waitingParentT, selectRoleView.transform);
             }
         };
         StartCoroutine(BundleMgr.CreateObject(kResource.View, "SelectRoleView", "SelectRoleView", handler));
     }
 }
示例#8
0
    // Start结束后 开启协程
    IEnumerator _DoStart()
    {
        yield return(0);

        _LoadLinkBeforeLoad();

        BundleMgr.DoInit();          // 加载资源

        _LoadLinkAfterLoad();

        if (!bTestView)            // 不存在就创建
        {
            StartCoroutine("_CreateLoginView");
        }
    }
示例#9
0
 // 战斗记录
 public void ShowBattleRecordView(Data_MapBattle_R data)
 {
     if (m_BattleRecordView == null)
     {
         System.Action <Object> handler = (asset) => {
             if (asset != null)
             {
                 GameObject battleRecordViewObject = (GameObject)GameObject.Instantiate(asset);
                 m_BattleRecordView = battleRecordViewObject.GetComponent <BattleRecordView>();
                 m_BattleRecordView.show(data);
                 NGUIUtility.SetParent(waitingParentT, battleRecordViewObject.transform);
             }
         };
         StartCoroutine(BundleMgr.CreateObject(kResource.View, "BattleRecordView", "BattleRecordView", handler));
     }
 }
示例#10
0
    // 显示输入   输入角色名字 等情况
    public void ShowInput(System.Action <string> callback)
    {
        if (m_InoutBoxView == null)
        {
            System.Action <Object> handler = (asset) => {
                if (asset != null)
                {
                    GameObject objInputBox = (GameObject)GameObject.Instantiate(asset);                      // 创建输入界面  显示
                    m_InoutBoxView = objInputBox.GetComponent <InoutBoxView>();
                    NGUIUtility.SetParent(waitingParentT, objInputBox.transform);
                    m_InoutBoxView.onShow(callback);
                }
            };

            StartCoroutine(BundleMgr.CreateObject(kResource.View, "InputBoxView", "InputBoxView", handler));
        }
    }
示例#11
0
    private IEnumerator _ShowWaiting()
    {
        yield return(new WaitForSeconds(1.0f));

        {
            if (m_WaitingView == null && waitingView != null)
            {
                System.Action <Object> handler = (asset) => {
                    if (asset != null)
                    {
                        m_WaitingView = (GameObject)GameObject.Instantiate(asset);
                        NGUIUtility.SetParent(waitingParentT, m_WaitingView.transform);
                    }
                };

                StartCoroutine(BundleMgr.CreateObject(kResource.Common, "WaitingView", "WaitingView", handler));
            }
        }
    }
示例#12
0
    // 开启协程 创建登录视图
    IEnumerator _CreateLoginView()
    {
        yield return(null);

        // 加载完之后需要执行这个回调 handler
        System.Action <Object> handler = (asset) => {
            if (asset != null)
            {
                GameObject dengluObject = (GameObject)GameObject.Instantiate(asset); // 登录视图
                m_DengluView = dengluObject.GetComponent <DengluView>();
                NGUIUtility.SetParent(waitingParentT, dengluObject.transform);       // waitingParentT => Anchor

                AudioManager.PlayLoopSound(bgAudio);                                 // 播放音乐
            }
            HideWaiting();
        };
        ShowWaiting();
        StartCoroutine(BundleMgr.CreateObject(kResource.View, "DengluView", "DengluView", handler));
    }
示例#13
0
    public void ShowWarn(int iTitle, string strMsg, System.Action callback)
    {
        string sTitle = LanguageMgr.GetString(iTitle);

        Debug.LogError(strMsg);
        if (m_MessageBoxView == null)
        {
            System.Action <Object> handler = (asset) => {
                if (asset != null)
                {
                    GameObject objMsgBox = (GameObject)GameObject.Instantiate(asset);                      // 创建弹窗 显示
                    m_MessageBoxView = objMsgBox.GetComponent <MessageBoxView>();
                    NGUIUtility.SetParent(waitingParentT, objMsgBox.transform);
                    m_MessageBoxView.show(sTitle, strMsg, callback);
                }
            };

            StartCoroutine(BundleMgr.CreateObject(kResource.View, "MessageBoxView", "MessageBoxView", handler));
        }
    }
示例#14
0
 public void ShowMainView()
 {
     if (m_MainView == null)            // 创建
     {
         System.Action <Object> handler = (asset) => {
             if (asset != null)
             {
                 GameObject mainView = (GameObject)GameObject.Instantiate(asset);
                 m_MainView = mainView.GetComponent <MainView>();
                 NGUIUtility.SetParent(waitingParentT, mainView.transform);
                 m_MainView.InitMap();
                 m_MainView.GetMapData();
             }
         };
         StartCoroutine(BundleMgr.CreateObject(kResource.View, "MainView", "MainView", handler));
     }
     else            // 是否需要刷新 玩家id  发送到服务端
     {
         if (MainPlayer.proMain.bNeedRefresh)
         {
             ShowWaiting();                  // 这里等待是为了下面数据的发送吗???
             Data_PlayerStat data = new Data_PlayerStat()
             {
                 characterId = MainPlayer.proMain.iCharacterId
             };
             Globals.It.SendMsg(data, Const_ICommand.PlayerStat);
         }
         else                // 刷新玩家 数据
         {
             m_MainView.gameObject.SetActive(true);
             m_MainView.RefreshMapStat();
             m_MainView.RefreshPlayerStat();
             Globals.It.HideWaiting();
         }
     }
 }
示例#15
0
 public void Clear()
 {
     Freq = 0;
     Channels = 0;
     Bits = 0;
     NumJumps = 0;
     Region = null;
     NumRegions = 0;
     Jump = null;
     NumSyncs = 0;
     Sync = null;
     NumMarkers = 0;
     Marker = null;
     EndFlag = false;
     InUse = false;
     AllData = null;
     OffsetData = 0;
     ResPtr = null;
     Name = null;
     SoundId = 0;
     Bundle = null;
     Type = 0;
     VolGroupId = 0;
     Disk = 0;
     CompressedStream = null;
     Compressed = false;
     LastFileName = null;
 }