| | |
| | |
|
| | | [SerializeField] RectTransform m_CrossServerOneVsOne;
|
| | | [SerializeField] Image m_CrossServerOneVsOneBg;
|
| | | [SerializeField] RectTransform m_CrossServerOneVsOneName;
|
| | | [SerializeField] Text m_MyName;
|
| | | [SerializeField] Text m_OpponentName;
|
| | |
|
| | |
| | | protected override void OnPreClose()
|
| | | {
|
| | | isCrossServerOneVsOne = false;
|
| | | loadingType = isCrossServerOneVsOne ? LoadingType.CrossServerOneOne : LoadingType.Normal;
|
| | |
|
| | | CameraUtility.StopShotCut(m_ScreenShotCut);
|
| | | if (!AssetSource.uiFromEditor)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (isCrossServerOneVsOne)
|
| | | switch (loadingType)
|
| | | {
|
| | | loadingType = LoadingType.CrossServerOneOne;
|
| | | case LoadingType.Normal:
|
| | | m_ContainerNormal.gameObject.SetActive(true);
|
| | | m_CrossServerOneVsOne.gameObject.SetActive(false);
|
| | |
|
| | | if (Application.platform == RuntimePlatform.IPhonePlayer)
|
| | | {
|
| | | m_ContainerProgress.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerProgress.gameObject.SetActive(true);
|
| | | m_ProgressSlider.ResetValue(0f);
|
| | | }
|
| | | break;
|
| | | case LoadingType.CrossServerOneOne:
|
| | | m_ContainerNormal.gameObject.SetActive(false);
|
| | | m_CrossServerOneVsOne.gameObject.SetActive(true);
|
| | | break;
|
| | | }
|
| | | else
|
| | |
|
| | | DisplayBackGround(loadingType ,useDefautBackGround);
|
| | | DisplayNameAndDescription();
|
| | | }
|
| | |
|
| | | private void DisplayBackGround(LoadingType loadingType, bool showDefault)
|
| | | {
|
| | | if (showDefault)
|
| | | {
|
| | | loadingType = LoadingType.Normal;
|
| | | var sprite = BuiltInLoader.LoadSprite("Launch_1");
|
| | | switch (loadingType)
|
| | | {
|
| | | case LoadingType.CrossServerOneOne:
|
| | | m_CrossServerOneVsOneBg.overrideSprite = sprite;
|
| | | m_CrossServerOneVsOneName.gameObject.SetActive(false);
|
| | | break;
|
| | | case LoadingType.Normal:
|
| | | m_BackGround.overrideSprite = sprite;
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | break;
|
| | | }
|
| | |
|
| | | return;
|
| | | }
|
| | |
|
| | | if (loadingType == LoadingType.CrossServerOneOne)
|
| | | {
|
| | | if (useDefautBackGround)
|
| | | {
|
| | | var sprite = BuiltInLoader.LoadSprite("Launch_1");
|
| | | m_CrossServerOneVsOneBg.overrideSprite = sprite;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_CrossServerOneVsOneBg.SetSprite("CrossServerOneVsOne_LoadingBG");
|
| | | }
|
| | |
|
| | | m_ContainerNormal.gameObject.SetActive(false);
|
| | | m_CrossServerOneVsOne.gameObject.SetActive(true);
|
| | |
|
| | | m_CrossServerOneVsOneBg.SetSprite("CrossServerOneVsOne_LoadingBG");
|
| | | m_CrossServerOneVsOneName.gameObject.SetActive(true);
|
| | | m_MyName.text = CrossServerLogin.Instance.oneVsOnePlayerData.myName;
|
| | | m_OpponentName.text = CrossServerLogin.Instance.oneVsOnePlayerData.opponentName;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerNormal.gameObject.SetActive(true);
|
| | | m_CrossServerOneVsOne.gameObject.SetActive(false);
|
| | | var playerLevel = PlayerDatas.Instance.baseData.LV == 0 ? PlayerDatas.Instance.loginInfo.LV : PlayerDatas.Instance.baseData.LV;
|
| | | var playerJob = PlayerDatas.Instance.baseData.Job == 0 ? PlayerDatas.Instance.loginInfo.Job : PlayerDatas.Instance.baseData.Job;
|
| | | var mapResConfig = MapResourcesConfig.Get(targetMapResId);
|
| | |
|
| | | if (useDefautBackGround)
|
| | | if (mapResConfig != null)
|
| | | {
|
| | | var sprite = BuiltInLoader.LoadSprite("Launch_1");
|
| | | m_BackGround.overrideSprite = sprite;
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | var playerLevel = PlayerDatas.Instance.baseData.LV == 0 ? PlayerDatas.Instance.loginInfo.LV : PlayerDatas.Instance.baseData.LV;
|
| | | var mapResConfig = MapResourcesConfig.Get(targetMapResId);
|
| | | if (mapResConfig != null)
|
| | | var config = LoadingBackGroundConfig.Get(mapResConfig.DataID, mapResConfig.LineID);
|
| | | var iconPool = new List<string>();
|
| | | iconPool.AddRange(config.icons);
|
| | | switch (playerJob)
|
| | | {
|
| | | var loadingBackGroudConfig = LoadingBackGroundConfig.Get(mapResConfig.DataID, mapResConfig.LineID);
|
| | | if (loadingBackGroudConfig != null && loadingBackGroudConfig.icons.Length > 0)
|
| | | case 1:
|
| | | iconPool.AddRange(config.jobIntroduce1);
|
| | | break;
|
| | | case 2:
|
| | | iconPool.AddRange(config.jobIntroduce2);
|
| | | break;
|
| | | }
|
| | |
|
| | | if (iconPool.Count > 0)
|
| | | {
|
| | | var icons = new List<string>();
|
| | | var json = JsonMapper.ToObject(config.levelLimit);
|
| | | for (var i = 0; i < iconPool.Count; i++)
|
| | | {
|
| | | var icons = new List<string>();
|
| | | var json = JsonMapper.ToObject(loadingBackGroudConfig.levelLimit);
|
| | |
|
| | | for (var i = 0; i < loadingBackGroudConfig.icons.Length; i++)
|
| | | var icon = iconPool[i];
|
| | | if (json.Keys.Contains(icon))
|
| | | {
|
| | | var icon = loadingBackGroudConfig.icons[i];
|
| | | if (json.Keys.Contains(icon))
|
| | | var min = 0;
|
| | | var max = int.MaxValue;
|
| | | var levelLimit = json[icon].ToString();
|
| | | var levelsMatch = Regex.Matches(levelLimit, "\\d+");
|
| | | if (levelsMatch.Count > 0)
|
| | | {
|
| | | var min = 0;
|
| | | var max = int.MaxValue;
|
| | | var levelLimit = json[icon].ToString();
|
| | | var levelsMatch = Regex.Matches(levelLimit, "\\d+");
|
| | | if (levelsMatch.Count > 0)
|
| | | {
|
| | | min = int.Parse(levelsMatch[0].Value);
|
| | | }
|
| | |
|
| | | if (levelsMatch.Count > 1)
|
| | | {
|
| | | max = int.Parse(levelsMatch[1].Value);
|
| | | }
|
| | |
|
| | | if (playerLevel > min && playerLevel < max)
|
| | | {
|
| | | icons.Add(icon);
|
| | | }
|
| | | min = int.Parse(levelsMatch[0].Value);
|
| | | }
|
| | | else
|
| | |
|
| | | if (levelsMatch.Count > 1)
|
| | | {
|
| | | max = int.Parse(levelsMatch[1].Value);
|
| | | }
|
| | |
|
| | | if (playerLevel > min && playerLevel < max)
|
| | | {
|
| | | icons.Add(icon);
|
| | | }
|
| | | }
|
| | |
|
| | | var randomIndex = UnityEngine.Random.Range(0, loadingBackGroudConfig.icons.Length > 1 ? icons.Count + 1 : 1);
|
| | | if (randomIndex == icons.Count)
|
| | | {
|
| | | m_BackGround.SetSprite(GeneralDefine.LoadLV);
|
| | | m_ContainerFunctions.gameObject.SetActive(true);
|
| | | var functions = GetShowFunctions(playerLevel);
|
| | | for (int i = 0; i < m_FunctionShows.Length; i++)
|
| | | {
|
| | | var show = m_FunctionShows[i];
|
| | | show.Display(functions[i]);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_BackGround.SetSprite(icons[randomIndex]);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | icons.Add(icon);
|
| | | }
|
| | |
|
| | | if (loadingBackGroudConfig != null && !string.IsNullOrEmpty(loadingBackGroudConfig.name))
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(true);
|
| | | m_MapName.SetSprite(loadingBackGroudConfig.name);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | if (loadingBackGroudConfig != null && !string.IsNullOrEmpty(loadingBackGroudConfig.description))
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(true);
|
| | | m_MapDescription.SetSprite(loadingBackGroudConfig.description);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | var randomIndex = UnityEngine.Random.Range(0, iconPool.Count > 1 ? icons.Count + 1 : 1);
|
| | | if (randomIndex == icons.Count)
|
| | | {
|
| | | m_BackGround.SetSprite(GeneralDefine.LoadLV);
|
| | | m_ContainerFunctions.gameObject.SetActive(true);
|
| | | var functions = GetShowFunctions(playerLevel);
|
| | | for (int i = 0; i < m_FunctionShows.Length; i++)
|
| | | {
|
| | | var show = m_FunctionShows[i];
|
| | | show.Display(functions[i]);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_BackGround.SetSprite(icons[randomIndex]);
|
| | | m_ContainerFunctions.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (Application.platform == RuntimePlatform.IPhonePlayer)
|
| | | {
|
| | | m_ContainerProgress.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerProgress.gameObject.SetActive(true);
|
| | | m_ProgressSlider.ResetValue(0f);
|
| | | }
|
| | | }
|
| | |
|
| | | private void DisplayNameAndDescription()
|
| | | {
|
| | | var mapResConfig = MapResourcesConfig.Get(targetMapResId);
|
| | | var config = LoadingBackGroundConfig.Get(mapResConfig.DataID, mapResConfig.LineID);
|
| | |
|
| | | if (config != null && !string.IsNullOrEmpty(config.name))
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(true);
|
| | | m_MapName.SetSprite(config.name);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapName.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | if (config != null && !string.IsNullOrEmpty(config.description))
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(true);
|
| | | m_MapDescription.SetSprite(config.description);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ContainerMapDescription.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | return functions;
|
| | | }
|
| | |
|
| | |
|
| | | public enum LoadingType
|
| | | {
|