Ejemplo n.º 1
0
    public static void openNextScene(SceneBase scene)
    {
        Tools.Log("===> openNextScene!");
        if (m_busy)
        {
            Tools.Log("next scene is busy now!");
            return;
        }
        //MgrPanel.disposeAllPanel();

        if (m_curScene != null)
        {
            MgrResLoader.insertRemoving(m_curScene.getResList());
            m_curScene.onLeave();
            m_curScene = null;
        }

        m_busy = true;
        PanelLoading.open();

        MgrResLoader.insertLoading(scene.getResList());
        m_nextScene = scene;

        MgrPanel.disposeAllPanel();
        MgrRes.clearObjectCacheAll();
        Util.ClearMemory();

        MgrResLoader.start(executeSceneDown);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Update the status
 /// </summary>
 /// <param name="displayText"></param>
 /// <param name="min"></param>
 /// <param name="max"></param>
 public void UpdateLoader(string displayText, int min, int max)
 {
     LabelLoader.Text       = displayText;
     ProgressLoader.Maximum = max;
     ProgressLoader.Value   = min;
     PanelLoading.Refresh();
 }
Ejemplo n.º 3
0
    public void RealLoadScene(SceneName name, PanelLoading ui)
    {
        ui.SetUI(LoadingType.Scene);
        AsyncOperation op       = null;
        Action         callback = () => { };

        switch (name)
        {
        case SceneName.A_SceneEnter:
            break;

        case SceneName.B_SceneLoading:
            op       = SceneManager.LoadSceneAsync("B_SceneLoading");
            callback = OnEnterSceneLoading;
            break;

        case SceneName.C_SceneLogin:
            op       = SceneManager.LoadSceneAsync("C_SceneLogin");
            callback = OnEnterSceneLogin;
            break;

        case SceneName.D_SceneGameInit:
            break;

        case SceneName.E_SceneGame_1:
            op       = SceneManager.LoadSceneAsync("E_SceneGame_1");
            callback = OnEnterSceneGame1;
            break;

        case SceneName.F_SceneGame_2:
            break;
        }
        StartCoroutine(Loading(op, callback, ui));
    }
Ejemplo n.º 4
0
        public Loader(string hostFileURL, string LocalSaveURL, PanelLoading ui)
        {
            this.HostFileURL  = hostFileURL;
            this.LocalSaveURL = LocalSaveURL;
            this.ui           = ui;

            this.WebClient = new WebClient();
            this.WebClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(this.OnDownloadProgressChanged);
            this.WebClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(this.OnDownloadFileCompleted);

            this.Start();
        }
Ejemplo n.º 5
0
    public static void open()
    {
        if (m_inst == null)
        {
            m_inst = new PanelLoading();
        }
        else
        {
            m_inst.gameObject.SetActive(true);
        }

        m_inst.transform.SetSiblingIndex(m_inst.transform.parent.childCount);
    }
Ejemplo n.º 6
0
        private IEnumerator _UpdateResource(PanelLoading ui)
        {
            if (IsUpdate())
            {
                LoadResource();
            }
            while (_loaderQueue.Count > 0 || this._displayQueue.Count > 0)
            {
                yield return(null);
            }

            this.OnLoadingCompleted();
        }
Ejemplo n.º 7
0
    void onClickCreate()
    {
        //List<string> list = new List<string>();
        //list.Add("1 Vs 1");
        //list.Add("2 Vs 2");
        //list.Add("3 Vs 3");
        //list.Add("4 Vs 4");
        //list.Add("5 Vs 5");

        //MgrPanel.openOption(list, onClickOption);

        PanelLoading.open();
        MgrScene.openNextScene(new SceneBattle());
    }
Ejemplo n.º 8
0
    private IEnumerator Loading(AsyncOperation op, Action callback, PanelLoading ui)
    {
        while (op.progress < 0.8)
        {
            yield return(null);

            ui.Loading(op.progress);
        }
        ui.Loading(1);
        while (!op.isDone)
        {
            yield return(null);
        }
        callback.Invoke();
    }
Ejemplo n.º 9
0
    private void PrepareLoading()
    {
        PanelMainMenu.SetActive(false);
        PanelBeforeMission.SetActive(false);
        PanelAfterMission.SetActive(false);
        PanelLoadingMission.SetActive(false);
        PanelLoading.SetActive(true);
        PanelMissionFailed.SetActive(false);
        PanelMinigame.SetActive(false);
        PanelSettings.SetActive(false);

        PanelLoading.GetComponent <PanelLoading>().TextTop = "Loading data";
        PanelLoading.GetComponent <PanelLoading>().TextTap = "";
        StartCoroutine(LoadDataCoroutine());
    }
Ejemplo n.º 10
0
    //public static void ShowLoading(List<ResourceItem> resources, Action callBack = null)
    //{
    //    var panelName = typeof(PanelLoading).Name;
    //    if (!m_panelDic.ContainsKey(panelName))
    //    {
    //        m_panelDic.Add(panelName, new PanelLoading());
    //        m_panelLoopList.Add(m_panelDic[panelName]);
    //    }

    //    if (m_loadingPanel != null)
    //        m_loadingPanel.HidePanel();

    //    m_loadingPanel = m_panelDic[panelName] as PanelLoading;
    //    m_loadingPanel.DontDestroyOnLoad = true;
    //    m_loadingPanel.SetParams(resources.ToArray());
    //    m_loadingPanel.OnLoadComplete += callBack;
    //    m_loadingPanel.ShowPanel(m_loadingLayer);
    //}

    public static void ShowLoading()
    {
        var panelName = typeof(PanelLoading).Name;

        if (!m_panelDic.ContainsKey(panelName))
        {
            m_panelDic.Add(panelName, new PanelLoading());
            m_panelLoopList.Add(m_panelDic[panelName]);
        }

        if (m_loadingPanel != null)
        {
            m_loadingPanel.HidePanel();
        }

        m_loadingPanel = m_panelDic[panelName] as PanelLoading;
        m_loadingPanel.DontDestroyOnLoad = true;
        m_loadingPanel.ShowPanel(CanvasOverlay);
        m_loadingPanel.LayerType = LayerType.Loading;
    }
Ejemplo n.º 11
0
    private IEnumerator LoadDataCoroutine()
    {
        WWW www = null;

        try {
            www = WebConnector.GetInitialData();
        } catch (Exception e) {
            Debug.Log("exception: " + e);
        }
        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            Debug.Log("www error: " + www.error);

            PanelLoading.GetComponent <PanelLoading>().JustDo  = () => { PrepareLoading(); };
            PanelLoading.GetComponent <PanelLoading>().TextTop = "Internet connection required. (" + www.error + ")";
            PanelLoading.GetComponent <PanelLoading>().TextTap = "Tap to retry";
        }
        else
        {
            JSONNode n = JSONNode.Parse(www.text);

            if (HasGoodVersion(n))
            {
                ParseInitialData(n);
            }
            else
            {
                PanelLoading.GetComponent <PanelLoading>().JustDo = () => { Application.OpenURL("https://play.google.com/store/apps/details?id=com.kprojekt.fingerofgod"); };
                string headlines = n["thisVersionHeadlines"].Value;
                PanelLoading.GetComponent <PanelLoading>().TextTop = "There is new version with: " + headlines;
                PanelLoading.GetComponent <PanelLoading>().TextTap = "Tap to update";
            }
        }
    }
Ejemplo n.º 12
0
    private void ParseInitialData(JSONNode n)
    {
        XmlDocument model = new XmlDocument();

        UserName = n["userName"].Value;
        string modelString = WWW.UnEscapeURL(n["model"]);

        model.LoadXml(modelString);

        XmlNode defaultsXml = model.GetElementsByTagName("defaults")[0];

        Dictionary <StatType, Dictionary <Element, float> > defaultStats = ParseStats(defaultsXml.ChildNodes);

        foreach (XmlNode buildingXml in model.GetElementsByTagName("building"))
        {
            Dictionary <StatType, Dictionary <Element, float> > thisStats = ParseStats(buildingXml.ChildNodes);
            foreach (StatType st in defaultStats.Keys.ToList())
            {
                foreach (Element el in defaultStats[st].Keys.ToList())
                {
                    if (!thisStats.ContainsKey(st))
                    {
                        thisStats.Add(st, defaultStats[st]);
                    }
                    if (!thisStats[st].ContainsKey(el))
                    {
                        thisStats[st].Add(el, defaultStats[st][el]);
                    }
                }
            }
            int    id         = int.Parse(buildingXml.Attributes["id"].Value);
            string name       = buildingXml.Attributes["name"].Value;
            int    population = int.Parse(buildingXml.Attributes["population"].Value);
            string imagePath  = buildingXml.Attributes["image"].Value;
            string imageDPath = buildingXml.Attributes["imageDestroyed"].Value;
            float  health     = float.Parse(buildingXml.Attributes["health"].Value == "" ? "1" : buildingXml.Attributes["health"].Value);

            Dictionary <Element, Sprite[]> effects = new Dictionary <Element, Sprite[]>();
            string fireEffectPath = buildingXml.Attributes["fireEffect"].Value == "" ? SpriteManager.DefaultEffectPaths[Element.Fire] : buildingXml.Attributes["fireEffect"].Value;
            effects.Add(Element.Fire, SpriteManager.ElementPerBuildingSprites[fireEffectPath]);

            string waterEffectPath = buildingXml.Attributes["waterEffect"].Value == "" ? SpriteManager.DefaultEffectPaths[Element.Water] : buildingXml.Attributes["waterEffect"].Value;
            effects.Add(Element.Water, SpriteManager.ElementPerBuildingSprites[waterEffectPath]);

            string electricityEffectPath = buildingXml.Attributes["electricityEffect"].Value == "" ? SpriteManager.DefaultEffectPaths[Element.Electricity] : buildingXml.Attributes["electricityEffect"].Value;
            effects.Add(Element.Electricity, SpriteManager.ElementPerBuildingSprites[electricityEffectPath]);

            string smokeAfterFireffectPath = buildingXml.Attributes["smokeAfterFireEffect"].Value == "" ? SpriteManager.DefaultEffectPaths[Element.SmokeAfterFire]: buildingXml.Attributes["smokeAfterFireEffect"].Value;
            effects.Add(Element.SmokeAfterFire, SpriteManager.ElementPerBuildingSprites[smokeAfterFireffectPath]);

            string crushEffectPath = buildingXml.Attributes["crushEffect"].Value == "" ? SpriteManager.DefaultEffectPaths[Element.Crush] : buildingXml.Attributes["crushEffect"].Value;
            effects.Add(Element.Crush, SpriteManager.ElementPerBuildingSprites[crushEffectPath]);

            string dieEffectPath = buildingXml.Attributes["dieEffect"].Value == "" ? SpriteManager.DefaultEffectPaths[Element.Die] : buildingXml.Attributes["dieEffect"].Value;
            effects.Add(Element.Die, SpriteManager.ElementPerBuildingSprites[dieEffectPath]);

            BuildingTemplates.Add(id, new BuildingTemplate(id, name, population, health, imagePath, imageDPath, thisStats, effects));
        }

        foreach (XmlNode power in model.GetElementsByTagName("power"))
        {
            TouchPowers.Add((Element)power.Attributes["elId"].Value);
        }

        PanelLoading pl = PanelLoading.GetComponent <PanelLoading>();

        PanelLoading.SetActive(false);
        PanelMainMenu.SetActive(true);
        PanelBeforeMission.SetActive(false);
        PanelAfterMission.SetActive(false);
        PanelLoadingMission.SetActive(false);
    }
Ejemplo n.º 13
0
 public void UpdateResource(PanelLoading ui)
 {
     this.ui = ui;
     StartCoroutine(_UpdateResource(ui));
 }
Ejemplo n.º 14
0
 void onClickOption(object o)
 {
     PanelLoading.open();
 }