示例#1
0
 void Button2Click()
 {
     id = 2;
     GameFrameEntry.GetModule <EffectModule>().Show(2, Button2.transform);
     MsgDispatcher.SendMessage(GlobalEventType.TaskFinish, id);
     Refresh();
 }
示例#2
0
 void Button3Click()
 {
     id = 3;
     if (effect3 == 0)
     {
         effect3 = GameFrameEntry.GetModule <EffectModule>().Show(3, Button3.transform);
     }
     else
     {
         GameFrameEntry.GetModule <EffectModule>().Close(effect3);
         effect3 = 0;
     }
     MsgDispatcher.SendMessage(GlobalEventType.TaskFinish, id);
     if (infoUI == 0)
     {
         GameFrameEntry.GetModule <UIModule>().Show <InfoUI>();
         infoUI = 1;
     }
     else
     {
         GameFrameEntry.GetModule <UIModule>().Close <InfoUI>();
         infoUI = 0;
     }
     Refresh();
 }
    async void StartMineGame()
    {
        await GameFrameEntry.Initialize();

        GameFrameEntry.Start();
        await new WaitForEndOfFrame();
        await GameFramework.LoadHelper.LoadScene(GameConst.MineGameMainScene);
    }
示例#4
0
        void RegisterProcedure()
        {
            List <ProcedureBase> procedureBases = new List <ProcedureBase>();

            procedureBases.Add(new Procedure.ProcedurePreLoad());
            procedureBases.Add(new Procedure.ProcedureStarGame());
            procedureBases.Add(new Procedure.ProcedureExitGame());
            GameFrameEntry.GetModule <ProcedureManager>().Register(procedureBases.ToArray());
        }
示例#5
0
 /// <summary>
 /// 初始化流程管理器。
 /// </summary>
 /// <param name="fsmManager">有限状态机管理器。</param>
 /// <param name="procedures">流程管理器包含的流程。</param>
 public void Register(params ProcedureBase[] procedures)
 {
     m_FsmManager = GameFrameEntry.GetModule <FsmManager>();
     if (m_FsmManager == null)
     {
         throw new GameFrameworkException("FSM manager is invalid.");
     }
     m_ProcedureFsm = m_FsmManager.CreateFsm(this, procedures);
 }
 /// <summary>
 /// 离开状态时调用。
 /// </summary>
 /// <param name="procedureOwner">流程持有者。</param>
 /// <param name="isShutdown">是否是关闭状态机时触发。</param>
 protected internal override void OnLeave(ProcedureOwner procedureOwner, bool isShutdown)
 {
     base.OnLeave(procedureOwner, isShutdown);
     GameFrameEntry.GetModule <TimeModule>().RemoveLoopTimer(GameTimer);
     touchTrail.TrailDestory();
     touchTrail = null;
     GameFramework.MsgDispatcher.RemoveEventListener(GameFramework.GlobalEventType.ReadyExitGame, ReadyExitGame);
     MsgDispatcher.RemoveEventListener(GameFramework.GlobalEventType.MainPanel_StartGame, MainPanel_StartGame);
 }
示例#7
0
 void MineGameExitLogic(object[] Args)
 {
     //清空计时器
     foreach (var item in dicGameModelLoopTimer.Values)
     {
         GameFrameEntry.GetModule <TimeModule>().RemoveLoopTimer(item);
     }
     dicGameModelLoopTimer.Clear();
 }
示例#8
0
        async void LoadEffect()
        {
            parent   = GameFrameEntry.GetModule <UIModule>().UIRoot;
            uiCamera = GameFrameEntry.GetModule <UIModule>().UICamera;
            self     = await LoadHelper.LoadPrefab("TouchTrail");

            self.transform.SetParent(parent);
            self.transform.SetAsLastSibling();
            rect = self.GetComponent <RectTransform>();
        }
示例#9
0
 /// <summary>添加事件监听</summary>
 override protected void Awake()
 {
     AddListener();
     Button1.AddClick(Button1Click);
     Button2.AddClick(Button2Click);
     Button3.AddClick(Button3Click);
     Button4.AddClick(Button4Click);
     //Button1.GetComponent<Image>().SetSprite("bg", "Common");
     Text3.text = GameFrameEntry.GetModule <LangModule>().Get("100");
     Refresh();
 }
示例#10
0
        void StopGameModeTimer(MineGameModel mineGameModel)
        {
            if (!dicGameModelLoopTimer.ContainsKey(mineGameModel))
            {
                CLog.Error($"不存在当前模式[{mineGameModel}]的计时器");
                return;
            }
            int id;

            dicGameModelLoopTimer.TryGetValue(mineGameModel, out id);
            GameFrameEntry.GetModule <TimeModule>().RemoveLoopTimer(id);
            dicGameModelLoopTimer.Remove(mineGameModel);
        }
示例#11
0
        public void DestroyObjectPool()
        {
            IObjectPoolManager objectPoolManager = GameFrameEntry.GetModule <ObjectPoolManager>();

            if (objectPoolManager != null)
            {
                objectPoolManager.DestroyObjectPool <NormalObject>(m_PoolName);
            }
            if (m_UnspawnParent != null)
            {
                GlobalUnityEngineAPI.Destroy(m_UnspawnParent.gameObject);
            }
        }
示例#12
0
        void SetLanguageData()
        {
            Dictionary <string, LangData> dicLanDatas = new Dictionary <string, LangData>();

            foreach (var item in ConfigMgr.Instance.dicLanguage.Values)
            {
                LangData langData = new LangData();
                langData.id    = item.id;
                langData.zh_cn = item.zh_cn;
                langData.en    = item.en;
                dicLanDatas.Add(langData.id, langData);
            }
            GameFrameEntry.GetModule <LangModule>().SetLangData(dicLanDatas);
        }
示例#13
0
        public void CreateObjectPool(string poolName, int capacity, float lifeTime, UnityEngine.Transform poolParent)
        {
            IObjectPoolManager objectPoolManager = GameFrameEntry.GetModule <ObjectPoolManager>();

            if (objectPoolManager != null)
            {
                m_PoolName      = poolName;
                m_UnspawnParent = poolParent;
                m_InstancePool  = objectPoolManager.CreateSingleSpawnObjectPool <NormalObject>(poolName);
                m_InstancePool.AutoReleaseInterval = lifeTime;
                m_InstancePool.Capacity            = capacity;
                m_InstancePool.ExpireTime          = lifeTime;
                m_InstancePool.Priority            = 0;
            }
        }
示例#14
0
 void Button1Click()
 {
     id = 1;
     if (effect1 == 0)
     {
         effect1 = GameFrameEntry.GetModule <EffectModule>().Show(1, Button1.transform.position + Vector3.up * 400, new Vector3(-90, 0, 0), Button1.transform);
     }
     else
     {
         GameFrameEntry.GetModule <EffectModule>().Close(effect1);
         effect1 = 0;
     }
     MsgDispatcher.SendMessage(GlobalEventType.TaskFinish, id);
     Refresh();
 }
示例#15
0
        void SetEffectData()
        {
            Dictionary <int, EffectData> dicEffectDatas = new Dictionary <int, EffectData>();

            foreach (var item in ConfigMgr.Instance.dicEffect.Values)
            {
                EffectData effectData = new EffectData();
                effectData.id       = item.id;
                effectData.type     = item.type;
                effectData.res      = item.res;
                effectData.duration = item.duration;
                dicEffectDatas.Add(effectData.id, effectData);
            }

            GameFrameEntry.GetModule <EffectModule>().SetEffectData(dicEffectDatas);
        }
示例#16
0
        void AddGmaeModeTimer(MineGameModel mineGameModel)
        {
            if (dicGameModelLoopTimer.ContainsKey(mineGameModel))
            {
                CLog.Error($"已存在当前模式[{mineGameModel}]的计时器");
                return;
            }
            if (dicGameModelLoopTimer.Count > 0)
            {
                CLog.Error($"模式计时器必须唯一,请先停掉之前的模式计时器");
                return;
            }

            int GameTimer = GameFrameEntry.GetModule <TimeModule>().AddLoopTimer(GameConst.ReportIntervalTimes, true, ReportGameTimes);

            dicGameModelLoopTimer.Add(mineGameModel, GameTimer);
        }
示例#17
0
    /// <summary>
    /// 设置图片
    /// </summary>
    /// <param name="img">图片对象</param>
    /// <param name="uiAtlas">UIAtlas</param>
    public static async void SetSpriteImage(this SpriteRenderer img, string spriteName, string uiAtlas = UIAtlas.PublickBg, bool autoSetSize = false)
    {
        if (img == null)
        {
            return;
        }
        SpriteAtlas atlas = await GameFrameEntry.GetModule <AssetbundleModule>().LoadSpriteAtlas(uiAtlas);

        if (img == null)
        {
            return;
        }
        img.sprite = atlas.GetSprite(spriteName);
        if (img.sprite == null && uiAtlas == UIAtlas.PublickBg)     //使用默认头像
        {
            img.sprite = atlas.GetSprite("Default");
        }
    }
示例#18
0
        void Awake()
        {
            DBTSDK.DBTSDKManager.InitSDK();
#if GameColletion
            AppName = GameFramework.GlobalData.MineAppName;
#endif
            AppSetting.MineGameName = AppName;
            DontDestroyOnLoad(this);
            GameFrameEntry.GetModule <VersionMondule>();
            GameFrameEntry.GetModule <AssetbundleModule>();
            GameFrameEntry.GetModule <UIModule>();
            GameFrameEntry.GetModule <TimeModule>();
            GameFrameEntry.GetModule <LangModule>();
            GameFrameEntry.GetModule <EffectModule>();
            GameFrameEntry.GetModule <FsmManager>();
            GameFrameEntry.GetModule <ProcedureManager>();
            GameFrameEntry.GetModule <MineGameLogicModule>();
            GameFrameEntry.GetModule <ObjectPoolManager>();
        }
示例#19
0
        async void Start()
        {
            DontDestroyOnLoad(this);
            await GameFrameEntry.Initialize();

            GameFrameEntry.Start();
            await new WaitForEndOfFrame();
            await ConfigMgr.Instance.Initialize();

            //提前设置多语言环境
            GameFrameEntry.GetModule <LangModule>().SetLocalLangLibrary(LocalELangLibrary.ZH_CN, ELangType.ZH_CN);
            GamePath.Instance.FindMineGamePath();
            RegisterProcedure();
            SetLanguageData();
            SetEffectData();
            RegisterLogicCtr();


            GameFrameEntry.GetModule <MineGameLogicModule>().InitCtrl();
            GameFrameEntry.GetModule <ProcedureManager>().StartProcedure <Procedure.ProcedurePreLoad>();
        }
示例#20
0
        /// <summary>
        /// Spawn 对象
        /// </summary>
        /// <param name="objAssetName">资源名称 带路径名 </param>
        /// <returns></returns>
        public async Task <UnityEngine.GameObject> Spawn(string objAssetName)
        {
            UnityEngine.GameObject target       = null;
            NormalObject           normalObject = m_InstancePool.Spawn(objAssetName);

            if (normalObject == null)
            {
                //UnityEngine.GameObject objAsset = ResourceManager.Instance.LoadAssetDataPath<UnityEngine.GameObject>(objAssetName);
                UnityEngine.GameObject objAsset = await GameFrameEntry.GetModule <AssetbundleModule>().LoadPrefab(objAssetName);

                if (objAsset != null)
                {
                    normalObject = new NormalObject(objAssetName, null, objAsset, m_UnspawnParent);
                    m_InstancePool.Register(normalObject, true);
                }
            }
            if (normalObject != null)
            {
                target = normalObject.Target as UnityEngine.GameObject;
            }
            return(target);
        }
示例#21
0
        /// <summary>
        /// 显示防沉迷提示 ContentCorlor带#号:#FFFFFF
        /// </summary>
        /// <param name="IsTop">是否在顶部</param>
        /// <param name="OffsetY">偏移量</param>
        /// <param name="txtContent"></param>
        public async void ShowAntiAddiction(bool IsTop, float OffsetY, string ContentCorlor = "", string txtContent = "")
        {
#if !UNITY_EDITOR
            //如果APP的当前语言不是简体中文,则不显示防沉迷
            if (GameFrameEntry.GetModule <LangModule>().LangType != ELangType.ZH_CN)
            {
                return;
            }
#endif

            if (IsShowAntiAddiction)
            {
                CLog.Log("已经显示过防沉迷提示了");
                return;
            }
            IsShowAntiAddiction = true;
            AntiAddictionPrefab.transform.SetParent(GameFrameEntry.GetModule <UIModule>()._GetUINode(EUINode.UIMessage.ToString()));
            RectTransform rect = AntiAddictionPrefab.GetComponent <RectTransform>();
            rect.localScale = Vector3.one;
            float x = GameFrameEntry.GetModule <UIModule>().UIRoot.rect.width;
            float y = GameFrameEntry.GetModule <UIModule>().UIRoot.rect.height;
            y = y - 50 + OffsetY;
            rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, x);
            rect.anchoredPosition = new Vector2(0, IsTop ? 0 : -y);
            //string content = GameFrameEntry.GetModule<LangModule>().Get("GameFramework.AntiAddictionText");
            //if (!string.IsNullOrEmpty(content))
            UnityEngine.UI.Text AText = AntiAddictionTxt.GetComponent <UnityEngine.UI.Text>();
            Color TextColor           = Color.white;
            if (!string.IsNullOrEmpty(ContentCorlor))
            {
                ColorUtility.TryParseHtmlString(ContentCorlor, out TextColor);
            }
            AText.text  = GameConst.GameFrameWorkLang.Get(GameConst.GameFrameWorkLang.GameFrameWorkLangKey.AntiAddictionTips);
            AText.color = TextColor;
            AntiAddictionPrefab.SetActive(true);
            await new WaitForEndOfFrame();
            AntiAddictionTxtTweener.ChangeEndValue(new Vector2(-AntiAddictionTxt.sizeDelta.x - x, 0)).Restart();
        }
    void Start()
    {
        CLog.Log("进入到GameFrameworkLoad场景");
        //模块关闭
        GameFrameEntry.Shutdown();

        if (GameFrameEntry.IsGoGameMenu)
        {
            if (string.IsNullOrEmpty(GameFrameEntry.GameMenuSceneName))
            {
                CLog.Error("游戏菜单场景是空的");
                return;
            }
            SceneManager.LoadScene(GameFrameEntry.GameMenuSceneName);
        }
        else
        {
            AppSetting.MineGameName = GlobalData.MineAppName;
            GameFrameEntry.GetModule <VersionMondule>();
            GameFrameEntry.GetModule <AssetbundleModule>();
            StartMineGame();
        }
    }
示例#23
0
 void Start()
 {
     textTarget      = gameObject.GetComponent <Text>();
     textTarget.text = GameFrameEntry.GetModule <LangModule>().Get(key);
 }
示例#24
0
        /// <summary>
        ///
        /// 显示信息流,传入信息流根节点
        /// </summary>
        /// <param name="InformationFlowRoot">信息流根节点</param>
        /// <returns>如果播放成功则返回信息流广告ID,如果不成功则返回-1</returns>
        public int ShowInformationFlow(RectTransform InformationFlowRoot)
        {
            //找到PictureRect和 FooterRect,注意:不要改变  InformationFlowRoot、PictureRect、FooterRect的中心点
            Image PictureImage = InformationFlowRoot.Find("PictureRect")?.GetComponent <Image>();
            Image FooterImage  = InformationFlowRoot.Find("FooterRect")?.GetComponent <Image>();
            Text  afterAd      = PictureImage.GetComponentInChildren <Text>();

            afterAd.enabled = false;
            //获取信息流状态
            int State = GetAdsStatusStatic(InformationFlowscene, InformationFlowID);

            CLog.Log("信息流状态=====" + State);
            switch (State)
            {
            case 0:    //不展示广告
                PictureImage.enabled = true;
                FooterImage.enabled  = false;
                break;

            case 1:    //只有主图
                PictureImage.enabled = false;
                FooterImage.enabled  = false;
                break;

            case 2:    //主图+底框
                PictureImage.enabled = false;
                FooterImage.enabled  = true;
                break;

            case 3:    //只有底框
                PictureImage.enabled = false;
                FooterImage.enabled  = true;
                afterAd.enabled      = true;
                break;
            }
            if (State != 0)
            {
                Camera UICamera = GameFrameEntry.GetModule <UIModule>().UICamera;//测试工程下 由于框架没有启动
                //Camera UICamera = Camera.main;
                float ScreenHeight = Screen.height;
                //InformationFlowRoot的矩阵
                Vector2[] InformationFlowRootScreenPoint = InformationFlowRoot.GetRect4ScreenPointPoint(UICamera);
                //由于平台是以手机左上为圆点  所以倒转Y轴
                int[] InforRect = CalculationPlatformRect(InformationFlowRootScreenPoint);

                //
                //Picture 大图矩阵
                Vector2[] PictureScreenPoint = PictureImage.rectTransform.GetRect4ScreenPointPoint(UICamera);
                int[]     PictureRect        = CalculationPlatformRect(PictureScreenPoint);
                PictureRect[0] = PictureRect[0] - InforRect[0];
                PictureRect[1] = PictureRect[1] - InforRect[1];

                //FooterImage 底框矩阵
                Vector2[] FooterScreenPoint = FooterImage.rectTransform.GetRect4ScreenPointPoint(UICamera);
                int[]     FooterRect        = CalculationPlatformRect(FooterScreenPoint);
                FooterRect[0] = FooterRect[0] - InforRect[0];
                FooterRect[1] = FooterRect[1] - InforRect[1];

                return(ShowAdsStatic(InformationFlowscene, InformationFlowID,
                                     InforRect, PictureRect, FooterRect,
                                     TitleColor, ActionBackgroundColor, ActionColor));
            }
            return(-1);
        }
        private void ShowMainPanelOrStarGame()
        {
#if !GameColletion
            GameFrameEntry.GetModule <UIModule>().Show <UI.MainUI.MainUI>();
#endif
        }
示例#26
0
 public void Refresh()
 {
     Value = GameFrameEntry.GetModule <LangModule>().Get(key);
 }
示例#27
0
 void RegisterLogicCtr()
 {
     GameFrameEntry.GetModule <MineGameLogicModule>().RegisterLogicCtr(TaskSystem.TaskCtrl.I);
     GameFrameEntry.GetModule <MineGameLogicModule>().RegisterLogicCtr(ModelCtrl.I);
 }