Exemplo n.º 1
0
    private void StopContentText()
    {
        SingletonMono <GameFrameWork> .GetInstance().StopCoroutine(Coroutine);

//        TitleText.text = "";
//        ShowText.text = "";
    }
Exemplo n.º 2
0
 protected override void OnInit(Camera UICamera)
 {
     base.OnInit(UICamera);
     LeftIcon   = CacheTransform.Find("Content/LeftImage").GetComponent <Image>();
     RightIcon  = CacheTransform.Find("Content/RightImage").GetComponent <Image>();
     LeftModel  = CacheTransform.Find("Content/LeftModel");
     RightModel = CacheTransform.Find("Content/RightModel");
     ShowText   = CacheTransform.Find("Content/ShowText").GetComponent <Text>();
     TitleText  = CacheTransform.Find("Content/TitleText").GetComponent <Text>();
     for (int i = 0; i < 4; i++)
     {
         Answers[i] = CacheTransform.Find("Content/AnswerBtn" + (i + 1)).gameObject;
         EventTriggerListener.Get(Answers[i].gameObject).SetEventHandle(EnumTouchEventType.OnClick, (a, b, c) =>
         {
             StopContentText();
             string nextNode = NodeData.Answers[(int)(c[0])].Target;
             if (nextNode == "end")
             {
                 //关闭界面
                 Singleton <WindowManager> .GetInstance().CloseWindow(false, "Dialogue");
                 return;
             }
             NodeData  = GetDialogue(nextNode);
             Coroutine = SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(ShowContentText());
         }, i);
     }
 }
Exemplo n.º 3
0
    protected override void OnClose(WindowContext context)
    {
        base.OnClose(context);
        _loadingContent.Clear();
        SingletonMono <SceneManager> .GetInstance().ProgressLoad -= RefreshInfo;

        _loadingContent = null;
    }
Exemplo n.º 4
0
        private void LoadServerVersionCallback(bool isOk, byte[] datas, string errorMessage)
        {
            if (isOk && datas != null && datas.Length > 0)
            {
                using (ByteBuffer buffer = new ByteBuffer(datas))
                {
                    platform = Singleton <GameEntry> .GetInstance().GetComponent <ResourceComponent>().PlatformName =
                        ValueParse.ReadValue(buffer, ValueParse.StringParse);

                    serverVersion = new Version.Version
                    {
                        MasterVersion  = ValueParse.ReadValue(buffer, ValueParse.IntParse),
                        MinorVersion   = ValueParse.ReadValue(buffer, ValueParse.IntParse),
                        RevisedVersion = ValueParse.ReadValue(buffer, ValueParse.IntParse)
                    };
                    Singleton <GameEntry> .GetInstance().GetComponent <ResourceComponent>().AssetBundleVariant =
                        ValueParse.ReadValue(buffer, ValueParse.StringParse);

                    serverBundleIsZip       = ValueParse.ReadValue(buffer, ValueParse.BoolParse);
                    serverBundleZipPassword = ValueParse.ReadValue(buffer, ValueParse.StringParse);
                }
                VersionCompareResult compareResult =
                    Version.Version.CompareResult(serverVersion, currentVersion, false);
                switch (compareResult)
                {
                case VersionCompareResult.Greater:
                    updatePanel.ShowMessageBox(UpdatePanel.enMessageBoxType.YesNo,
                                               UpdateStringConfig.UpdateStatusBeginUpdate,
                                               UpdateStringConfig.UpdateStringHasFatalErrorNeedReinstall,
                                               () =>
                    {
                        OpenAppStore(SingletonMono <GameFramework> .GetInstance().GetAppId());
                        if (Application.isPlaying)
                        {
                            Application.Quit();
                        }
                    }, () =>
                    {
                        if (Application.isPlaying)
                        {
                            Application.Quit();
                        }
                    });
                    break;

                case VersionCompareResult.Equal:
                case VersionCompareResult.Less:
                    UpdateResource();
                    break;
                }
            }
            else
            {
                //获取服务器的版本信息失败
                isUpdateDone = true;
                updateError("获取服务器的版本信息失败");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 初始化SDK
        /// </summary>
        /// <returns></returns>
        IEnumerator InitSDK()
        {
            StatusText.text = Singleton <LanguageManager> .GetInstance().GetLanguage(LanguageId.Resource_InitSDK);

            ProgressText.text = string.Format("{0}%", 0);
            yield return(SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(Singleton <Interface> .GetInstance().InitSDK()));

            m_isInitSDKDone = true;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 检查SDK
        /// </summary>
        /// <returns></returns>
        IEnumerator CheckSDK()
        {
            StatusText.text = Singleton <LanguageManager> .GetInstance().GetLanguage(LanguageId.Resource_CheckSDK);

            ProgressText.text = string.Format("{0}%", 0);
            Singleton <Interface> .GetInstance().Init();

            yield return(SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(Singleton <Interface> .GetInstance().CheckSDK()));

            State = enClientState.State_InitSDK;
        }
Exemplo n.º 7
0
    protected override void OnAppear(int sequence, int openOrder, WindowContext context)
    {
        base.OnAppear(sequence, openOrder, context);
        Content = context as DialogueContent;
//        LeftIcon.sprite = Content.LeftIcon;
//        RightIcon.sprite = Content.RightIcon;
//        Content.LeftModel.transform.SetParent(LeftModel);
//        Content.RightModel.transform.SetParent(RightModel);
        LoadDialogueData(Content.FileName);
        this.NodeData = GetDialogue(Content.StartNode);
        Coroutine     = SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(ShowContentText());
    }
Exemplo n.º 8
0
 protected override void OnAppear(int sequence, int openOrder, WindowContext context)
 {
     base.OnAppear(sequence, openOrder, context);
     _loadingContent = context as LoadingContent;
     Clear();
     if (_loadingContent != null)
     {
         if (_loadingContent.AppearCallBack != null)
         {
             _loadingContent.AppearCallBack.Invoke();
             SingletonMono <SceneManager> .GetInstance().ProgressLoad += RefreshInfo;
         }
     }
     else
     {
         Debug.LogError("Loading Error ............");
     }
 }
Exemplo n.º 9
0
 public override void OnAwake()
 {
     base.OnAwake();
     soundManager = new SoundManager();
     if (instanceRoot == null)
     {
         instanceRoot = (new GameObject("SoundGroup Root")).transform;
         instanceRoot.SetParent(gameObject.transform);
         instanceRoot.localScale    = Vector3.one;
         instanceRoot.localPosition = Vector3.zero;
     }
     for (int i = 0; i < SingletonMono <GameFramework> .GetInstance().SoundGroupInfos.Length; i++)
     {
         if (!AddSoundGroup(SingletonMono <GameFramework> .GetInstance().SoundGroupInfos[i]))
         {
             Debuger.LogError("Add sound group '{0}' failure.", LogColor.Red, SingletonMono <GameFramework> .GetInstance().SoundGroupInfos[i].Name);
             continue;
         }
     }
 }
Exemplo n.º 10
0
        public override void OnAwake()
        {
            base.OnAwake();
            webManager = new WebManager();
            if (instanceRoot == null)
            {
                instanceRoot = (new GameObject("Web Request Root")).transform;
                instanceRoot.SetParent(gameObject.transform);
                instanceRoot.localScale    = Vector3.one;
                instanceRoot.localPosition = Vector3.zero;
            }

            for (int i = 0; i < SingletonMono <GameFramework> .GetInstance().WebRequestCount; i++)
            {
                WebAgent webAgent = new GameObject("WebRequest_" + (i + 1)).AddComponent <WebAgent>();
                webAgent.transform.SetParent(instanceRoot);
                webAgent.transform.localPosition = Vector3.zero;
                webAgent.transform.localScale    = Vector3.one;
                webManager.AddWebRequestAgent(webAgent);
            }
        }
Exemplo n.º 11
0
 public void AsynLoadConfig(string fileName, bool isCacheBundle, Action <string> callBack)
 {
     if (ConfigConst.ConfigBundleMode)
     {
         if (CallBacks.ContainsKey(fileName))
         {
             Action <string> action = CallBacks[fileName];
             action += callBack;
             return;
         }
         else
         {
             CallBacks[fileName] = callBack;
             SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(AsynReadFile(fileName, isCacheBundle));
         }
     }
     else
     {
         Debuger.LogError("编辑器模式不支持异步夹杂config文件  ConfigBundleMode==false");
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// 检查沙河目录与streamassets的版本
        /// </summary>
        private void CheckVersion()
        {
            int  isCopy    = PlayerPrefsUtil.GetIntSimple(PlayerPrefsKey.IsCopyAssets);
            bool needUnzip = false;

            if (isCopy == 1)
            {
                GetCurrentVersion();
                if (currentVersion != null && initalVersion != null)
                {
                    var result = Version.Version.CompareVersion(initalVersion, currentVersion);
                    if (result == CompareResult.Greater)
                    {
                        //安装包的版本大于沙河目录的版本
                        needUnzip = true;
                    }
                }
                else if (currentVersion == null && initalVersion != null)
                {
                    needUnzip = true;
                }
            }
            else
            {
                needUnzip = true;
            }
            if (needUnzip)
            {
                RefAppVersion(initalVersion, onlineVersion, false);
                ClearData();
                SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(Preprocess());
            }
            else
            {
                isCopyDone = true;
                RefAppVersion(currentVersion, onlineVersion, false);
                PlayerPrefsUtil.SetIntSimple(PlayerPrefsKey.IsCopyAssets, 1);
            }
        }
Exemplo n.º 13
0
 void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     SingletonMono <GameFrameWork> .GetInstance();
 }
Exemplo n.º 14
0
        /// <summary>
        /// 判断热更新还是下客户端
        /// </summary>
        /// <returns></returns>
        IEnumerator UpdateApp()
        {
            m_updateState   = 1;
            isUpdateAppDone = false;
            m_urlIndex      = GameConfig.UpdateServer.Length - 1;
            m_loadOver      = false;
            while (!m_loadOver && m_urlIndex >= 0)
            {
                yield return(SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(DownloadAppFile()));

                m_urlIndex--;
            }
            if (m_loadOver == false)//当前服务器列表不可用
            {
                m_updateState = 3;
                yield break;
            }
            RefAppVersion(currentVersion, onlineVersion);
            GetCurrentVersion(true);
            CompareResult result = Version.Version.CompareVersion(onlineVersion, currentVersion, false);

            switch (result)
            {
            case CompareResult.Equal:
                isUpdateAppDone = true;
                yield break;

            case CompareResult.Error:
                isUpdateAppDone = true;
                yield break;

            case CompareResult.Greater:
                m_updateState = 2;
                using (var www = new WWW(GameConfig.UpdateAppUrl))
                {
                    yield return(www);

                    if (www.error != null)
                    {
                        yield break;
                    }
                    string appurl = www.text.Trim();

                    AlertContextText.text = Singleton <LanguageManager> .GetInstance()
                                            .GetLanguage(LanguageId.Resource_DownloadNewApp);

                    AlertObject.SetActive(true);
                    EventTriggerListener.Get(CancelButton.gameObject).SetEventHandle(EnumTouchEventType.OnClick,
                                                                                     (a, b, c) =>
                    {
                        Application.Quit();
                    });
                    EventTriggerListener.Get(SureButton.gameObject).SetEventHandle(EnumTouchEventType.OnClick,
                                                                                   (a, b, c) =>
                    {
                        Application.OpenURL(appurl);
                        Application.Quit();
                    });
                }
                yield break;

            case CompareResult.Less:
                isUpdateAppDone = true;
                yield break;
            }
        }
Exemplo n.º 15
0
        public void OnUpdate()
        {
            if (m_isBeginUpdate && isLoadOldTableAndVersion)
            {
                switch (State)
                {
                case  enClientState.State_Init:
                    if (!m_isCheckSDK)
                    {
                        m_isCheckSDK = true;
                        SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(CheckSDK());
                    }
                    break;

                case enClientState.State_InitSDK:
                    if (!m_isInitSDK)
                    {
                        m_isInitSDK     = true;
                        m_isInitSDKDone = false;
                        SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(InitSDK());
                    }
                    if (m_isInitSDK && this.m_isInitSDKDone)
                    {
                        this.State = enClientState.State_UnZipData;
                        CheckVersion();
                    }
                    break;

                case enClientState.State_UnZipData:
                    if (isCopyDone)
                    {
                        if (Util.NetAvailable)
                        {
                            StatusText.text = Singleton <LanguageManager> .GetInstance().GetLanguage(LanguageId.Resource_OffLine);
                        }
                        else
                        {
                            State = enClientState.State_UpdateApp;
                            SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(UpdateApp());
                        }
                        ProgressSliber.value = 1;
                        ProgressText.text    = string.Format("{0}%", 100);
                    }
                    else
                    {
                        RefLauncherInfo();
                    }
                    break;

                case  enClientState.State_UpdateApp:
                    if (isUpdateAppDone)
                    {
                        State = enClientState.State_UpdateResource;
                        SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(UpdateResource());
                    }
                    RefLauncherInfo();
                    break;

                case  enClientState.State_UpdateResource:
                    if (isDownloadDone)
                    {
                        State = enClientState.State_Start;
                    }
                    RefLauncherInfo();
                    break;

                case  enClientState.State_Start:
                    Clear();
                    UpdateCallback(true);
                    m_isBeginUpdate = false;
                    break;
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 检查更新资源
        /// </summary>
        /// <returns></returns>
        IEnumerator UpdateResource()
        {
            m_updateState  = 1;
            isDownloadDone = false;
            LoadCurrentMd5Table();
            LoadHasUpdateSet();
            bool bCheck   = CheckOldMd5File();
            bool bVersion = (currentVersion.Revised < onlineVersion.Revised);

            Debuger.LogError("是否需要更新资源= " + bVersion + ", 沙河目录的app版本 = " + currentVersion + ", 服务器上的app版本 = " + onlineVersion);
            if (!bCheck && !bVersion)
            {
                m_updateState  = 3;
                isDownloadDone = true;
                yield break;
            }
            m_urlIndex = GameConfig.UpdateServer.Length - 1;
            m_loadOver = false;
            while (!m_loadOver && m_urlIndex > 0)
            {
                yield return(SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(DownloadMD5File()));

                m_urlIndex++;
            }
            if (!m_loadOver)
            {
                m_updateState = 4;
                yield break;
            }
            DeleteUselessFiles();
            GetDownloadFileList();
            if (!isDownloadDone)
            {
                if (Util.IsCarrier)
                {
                    if (TotalDownloadSize > 1048576)
                    {
                        AlertContextText.text =
                            string.Format(Singleton <LanguageManager> .GetInstance().GetLanguage(LanguageId.DownloadSizeAlert),
                                          TotalDownloadSize / 1048576f);
                        AlertObject.SetActive(true);
                        EventTriggerListener.Get(CancelButton.gameObject).SetEventHandle(EnumTouchEventType.OnClick,
                                                                                         (a, b, c) =>
                        {
                            Application.Quit();
                        });
                        EventTriggerListener.Get(SureButton.gameObject).SetEventHandle(EnumTouchEventType.OnClick,
                                                                                       (a, b, c) =>
                        {
                            AlertObject.gameObject.SetActive(false);
                            SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(BeginDownloadResource());
                        });
                    }
                    else
                    {
                        SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(BeginDownloadResource());
                    }
                }
                else
                {
                    SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(BeginDownloadResource());
                }
            }
            else
            {
                m_updateState = 3;
            }
        }
Exemplo n.º 17
0
 public override void Init()
 {
     base.Init();
     CanvasObj = GameObject.Find("Canvas");
     SingletonMono <GameFrameWork> .GetInstance().StartCoroutine(LoadOldTableAndVersion());
 }