Exemplo n.º 1
0
 public static NotifacitionCenter GetInstance()
 {
     if (instance == null)
     {
         instance = new NotifacitionCenter();
     }
     return(instance);
 }
Exemplo n.º 2
0
    public override void OnSceneLoaded()
    {
        Debug.Log("MainMapScene load activescene=[" + SceneManager.GetActiveScene().name + "]");
        //创建场景消息管理中心
        MapSceneMsgCenter = new NotifacitionCenter();
        //创建UI管理器管理UI
        Singleton <UIManager> .Create();

        Singleton <ContextManager> .Create();

        //string mappath = Application.dataPath + "/StreamingAssets/AssetBundles/maptile";
        //string mapuipath = Application.dataPath + "/StreamingAssets/AssetBundles/mapsceneui";
        //string rolepath = Application.dataPath + "/StreamingAssets/AssetBundles/role";

        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/AssetBundles");
        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/maptile");
        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/mapsceneui");
        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/role");



        //AssetBundle mapBundle = AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/AssetBundles/maptile");
        //AssetBundle mapUiBundle= AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/AssetBundles/mapsceneui");
        //AssetBundle roleBundle=AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/AssetBundles/role");



        //创建地图实例
        Singleton <TiledMapInfo> .Create();

        objgather  = Singleton <lc_ObjGather> .Instance;
        objmanager = new lc_ObjManager(objgather);
        objviewer  = new lc_ObjViewer(objgather);


        //加载游戏地图及游戏脚本文件
        string mapfilepath  = Application.dataPath + @"/StreamingAssets/Map/MapInfo.tmx";
        string gamefilepath = Application.dataPath + @"/StreamingAssets/Game/GameData.xml";

        XmlLoad.MapTileXmlLoad(mapfilepath, Singleton <TiledMapInfo> .Instance);
        XmlLoad.GameXmlLoad(gamefilepath, objgather, Singleton <TiledMapInfo> .Instance);

        //UI初始化
        Singleton <ContextManager> .Instance.Push(new ActiveMenuContext());

        Singleton <ContextManager> .Instance.Push(new OptionPanelContext());

        Singleton <ContextManager> .Instance.Push(new PopInterFacePanelContext());

        Singleton <ContextManager> .Instance.NoStackPush(new CityInfoSignContext());

        //创建地图生成器生成地图
        GameObject go = new GameObject("MapMaker");

        go.AddComponent <hexgrid>();

        CreateGameTest();
    }
Exemplo n.º 3
0
    public override void OnSceneLoaded()
    {
        Debug.Log("MainMenuscene load !");
        //创建场景消息管理中心
        MapSceneMsgCenter = new NotifacitionCenter();

        //创建空游戏实例
        Singleton <lc_ObjGather> .Create();
    }
Exemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (_showEventLabelTime < showEventLabelTime)
     {
         _showEventLabelTime += Time.deltaTime;
     }
     else
     {
         UIMgr._instance.mainUI.eventLabel.gameObject.SetActive(true);
         _showEventLabelTime = -10000;
     }
     if (_showEventTime < showEventTime)
     {
         _showEventTime += Time.deltaTime;
     }
     else
     {
         this.needRote = false;
         NotifacitionCenter.getInstance().Emit("EventShow", this);
         _showEventTime = -10000;
     }
 }
Exemplo n.º 5
0
 public void NextDay()
 {
     NotifacitionCenter.getInstance().Emit("OnEnterDay", this);
     OnEnterDay();
 }
Exemplo n.º 6
0
 public void CloseEventPanel()
 {
     eventPanel.SetActive(false);
     NotifacitionCenter.getInstance().Emit("OnEnterNight", this);
     OnEnterNight();
 }
Exemplo n.º 7
0
 private void OnDisable()
 {
     NotifacitionCenter.getInstance().Off("OnEnterDay", EnterDay);
     NotifacitionCenter.getInstance().Off("OnEnterNight", EnterNight);
 }
Exemplo n.º 8
0
 private void OnDisable()
 {
     NotifacitionCenter.getInstance().Off("EventHide", Hide);
     NotifacitionCenter.getInstance().Off("EventShow", Show);
 }
Exemplo n.º 9
0
 private void OnMouseDown()
 {
     NotifacitionCenter.getInstance().Emit("EventHide", this);
     UIMgr._instance.mainUI.ShowEventPanel();
 }