コード例 #1
0
        void OnDisable()
        {
            MainUICamera.getInstance().UnRegisterGesture();
            UIMainScene.getInstance().OnDisable();
            if (playerEntity != null)
            {
                playerEntity.removeEventListener(PlayerEntity.MainNinjaChangeEvent, UpdateActor);
            }
            KHUIManager inst = KHUIManager.getInstance();

            if (inst != null && inst.Dispatcher != null)
            {
                inst.Dispatcher.removeEventListener("OnOpenWindow", OnOpenOtherWindow);
                inst.Dispatcher.removeEventListener("OnCloseWindow", OnCloseOtherWindow);
            }

            mainModel.Dispatcher.removeEventListener(UIMainScene.EVT_REQ_SCENE_CHANGE_CHECK, OnReqSceneChangeCheckRecived);

            KHSceneSettingModel sceneSettingModel = KHPluginManager.Instance.GetModel(KHSceneSettingPlugin.pluginName) as KHSceneSettingModel;

            sceneSettingModel.Dispatcher.removeEventListener(KHSceneSettingModel.SELECT_SCENE_SETTING_EVT, OnRreshSceneSetting);
            sceneSettingModel.Dispatcher.removeEventListener(KHSceneSettingModel.PREVIEW_SCENE_SETTING_CANCEL_EVT, OnRreshSceneSetting);
            sceneSettingModel.Dispatcher.removeEventListener(KHSceneSettingModel.PREVIEW_SCENE_SETTING_EVT, OnRreshSceneSetting);

            UnReigstBuildingButtonClickEvtProc();
        }
コード例 #2
0
    static public UIMainScene getInstance()
    {
        if (_Instance == null)
        {
            _Instance = new UIMainScene();
            //_Instance._initialize();
        }

        return(_Instance);
    }
コード例 #3
0
        void Update()
        {
            MainUICamera.getInstance().update(Time.deltaTime);
            UIMainScene.getInstance().Update();

//			if (Input.GetKeyDown (KeyCode.A))
//			{
//				Debuger.Log("KeyCode........................................A");
//				//UIActivityTipView.ShowTip("ABC", "12345");
//				//KHPluginManager.Instance.SendMessage(UltimateKillPlugin.pluginName, UltimateKillZhanjiAndRewardOperation.OpenZhanjiRewardView);
//				//KHPluginManager.Instance.SendMessage(UltimateKillPlugin.pluginName, UltimateKillOperation.OpenRewardView);
//
//				UIShareMainCityView.TopName = KHUIManager.getInstance ().GetTopWindow ().name;
//				KHPluginManager.Instance.SendMessage(SharePlugin.PLUGIN_NAME, "ShowView", new ShowViewArgument(UIDef.SHARE_MAINCITY_VIEW, false, null));
//				//UIActivityTipView.ShowTipV2(KHDataManager.CONFIG.GetFeatureDefineTitle1(SystemConfigDef.Match), KHDataManager.CONFIG.GetFeatureDefineDes1(SystemConfigDef.Match),"");
//				//单触发定时器:Invoke(string method, int Secondtimes) 过Secondtimes 秒后触发method 函数,
//				//重复触发InvokeRepeating(string method, int Secondtimetowake, int Secondtimetonext)每Secondtimetonext触发下一次
//			}
        }
コード例 #4
0
        private void DoRefereshSceneLoad()
        {
            MainSceneLoader.Instance.RefereshLoad((praScenePrefabGo, praIsDiff) =>
            {
                if ((praIsDiff) && (praScenePrefabGo != null) && !mIsDestroy)
                {
                    //如果处于隐藏状态, 则尝试切换
                    if (UIMainScene.getInstance().GetVisibleState() == false || forceToRefresh)
                    {
                        //Debuger.Log("来切换一把");
                        this.RefereshMainScene();

                        //更新忍者皮肤设置
                        this.UpdateActorPrefabSet(actorId, curActorCfg, CharacterPos);

                        forceToRefresh = false;
                    }
                }
            });
        }
コード例 #5
0
        public void initialize(UIMainScene scene)
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                //安卓机型一测时手感速度提升
                speedRate = 0.064f;
            }
            destRate   = 0.004f * (Screen.width / 960f);
            this.scene = scene;
            this.scene.dispatcher.addEventListener(KHEvent.COMPLETE, this.onSceneInit);
            Debuger.Log("test0");

            Debuger.Log("当前场景: " + Application.loadedLevel + " " + Application.loadedLevelName);

            //this.scene.dispatcher.addEventListener(KHSceneEvent.OPEN_AREA_CHANGE, this.onSceneInit);
            GameObject cameraObj = GameObject.Find("UI Root");

            Debuger.Log("test1");

            uicamera = cameraObj.transform.FindChild("Camera").GetComponent <UICamera>();
            Debuger.Log("test2");

            this.unityCamera = uicamera.transform;
            Debuger.Log("[初始化主场景相机] uicamera.name = " + uicamera.gameObject.name);

            cameraPos = new Vector3(InitCameraLookAtPos, 0, 0); //Vector3.zero;
            destPos   = new Vector3(InitCameraLookAtPos, 0, 0); //Vector3.zero;
            this.cameraBehaviourList      = new List <KHCameraBehaviour>();
            this.positionLimitRectCurrent = new Rectangle();
            offset = Camera.main.orthographicSize * Camera.main.aspect * 0.3f;
            Debuger.Log("test3");

            RegisterGesture();
            calculatePositionLimitRect();
            calculatePositionPercent();

            //CreateBound();
        }
コード例 #6
0
 void OnDestroy()
 {
     mIsDestroy = true;
     MainSceneLoader.Instance.ClearUsingInf();
     UIMainScene.getInstance().ClearUIRef();
 }
コード例 #7
0
        void RefereshMainScene()
        {
            var tMainModel = KHPluginManager.Instance.GetModel("MainUI") as MainUIModel;

            bool tSceneChanged = false;

            //找到当前是否已经存在的纹理层
            Transform tCurSceneInstTrans = null;

            for (int i = 0, max = this.SceneRoot.childCount; i < max; ++i)
            {
                Transform tTrans = this.SceneRoot.GetChild(i);
                if (tTrans.gameObject != this.sceneLogic && !tTrans.gameObject.name.Equals("IPX_BOUND"))
                {
                    if (null == tCurSceneInstTrans)
                    {
                        tCurSceneInstTrans = tTrans;
                    }
                    else
                    {
                        Debuger.LogError("场景层级结构错误, 有多个纹理层");
                    }
                }
            }

            //要销毁的旧场景
            GameObject tOldSceneTransToDestroy = null;

            //当前场景挂着的GameObject
            GameObject tCurSceneInstGo = (tCurSceneInstTrans != null) ? (tCurSceneInstTrans.gameObject) : (null);

            //当前场景所需 (must not null.)
            string tCurSceneResPath = MainSceneLoader.Instance.CurShouldUseSceneResPath();

            if (string.IsNullOrEmpty(tCurSceneResPath))
            {
                Debuger.LogError("当前场景资源无配置");
                return;
            }

            //当前实例指向
            string tCurUsingResPath = MainSceneLoader.Instance.CurUsingResPath;

            //如果当前所需场景和MainUi上已经挂接的实例不相同
            if (tCurSceneResPath != tCurUsingResPath)
            {
                //生成新场景, 此处必定保证非空
                GameObject tScenePrefab = MainSceneLoader.Instance.CurShouldUseSceneGo();
                if (tScenePrefab)
                {
                    KHResource.unLoadRes(tCurSceneResPath, null);
                    KHResource.unLoadRes(tCurUsingResPath, null);
                    GameObject tSceneInstance = GameObject.Instantiate(tScenePrefab) as GameObject;
                    //append
                    tSceneInstance.transform.parent        = this.SceneRoot;
                    tSceneInstance.transform.localPosition = Vector3.zero;
                    tSceneInstance.transform.localScale    = Vector3.one;

                    //销毁旧场景
                    tOldSceneTransToDestroy = tCurSceneInstGo;

                    tCurSceneInstGo = tSceneInstance;
                    MainSceneLoader.Instance.CurUsingResPath  = tCurSceneResPath;
                    MainSceneLoader.Instance.CurUsingInstance = tSceneInstance;

                    tSceneChanged = true;

                    Debuger.Log(string.Format("新场景加载完毕_ tCurSceneResPath:{0} | tCurUsingResPath:{1}",
                                              (tCurSceneResPath != null) ? tCurSceneResPath : "null", (tCurUsingResPath != null) ? tCurUsingResPath : "null"));
                }
                else
                {
                    Debuger.LogError("未读取到场景资源资源");
                    return;
                }
            }
            else
            {
                Debuger.Log(string.Format("场景实例不变_ {0}", (tCurUsingResPath != null) ? tCurUsingResPath : "null"));
                return;
            }

            SceneUIObject tSceneWarrper = new SceneUIObject();

            tSceneWarrper.AddScene(sceneLogic, true);
            if (tCurSceneInstGo != null)
            {
                tSceneWarrper.AddScene(tCurSceneInstGo);
                tSceneWarrper.SetCurrScene(tCurSceneInstGo);
                UIMainScene.getInstance()._initialize(tSceneWarrper);
            }

            //发出场景变换事件
            if (tSceneChanged)
            {
                tMainModel.Dispatcher.dispatchEvent(new KHEvent(MainUIModel.EVT_MAINSCNENE_CHANGED));
            }

            if (tOldSceneTransToDestroy != null)
            {
                GameObject.Destroy(tOldSceneTransToDestroy.gameObject);
            }
        }