public void GoToPage(PageType pageType) { RXDebug.Log("Here i am changing the page"); if (_currentPageType == pageType) { return; } Page pageToCreate = null; if (pageType == PageType.MenuPage) { pageToCreate = new MenuPage(); } if (pageType == PageType.InGamePage) { pageToCreate = new InGamePage(); } if (pageToCreate != null) { _currentPageType = pageType; if (_currentPage != null) { _stage.RemoveChild(_currentPage); } _currentPage = pageToCreate; _stage.AddChild(_currentPage); _currentPage.Start(); } }
// Update is called once per frame virtual public void Update() { if (_currentAnim != null && !_pause) { _time += Time.deltaTime; while (_time > (float)_currentAnim.delay / 1000.0f) // looping this way will skip frames if needed { _currentFrame++; if (_currentFrame >= _currentAnim.totalFrames) { if (_currentAnim.looping) { _currentFrame = 0; isStopped = false; } else { _currentFrame = _currentAnim.totalFrames - 1; isStopped = true; RXDebug.Log("Finished anim"); } // send Signal if it exists //_currentAnim.checkFinished(); } element = Futile.atlasManager.GetElementWithName(_baseName + "_" + _currentAnim.frames[_currentFrame]); _time -= (float)_currentAnim.delay / 1000.0f; } } }
void Start() { RXDebug.Log("Starting the demo"); instance = this; Go.defaultEaseType = EaseType.Linear; Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty; FutileParams fparams = new FutileParams(true, true, false, false); fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, ""); //iPhone // fparams.AddResolutionLevel(960.0f, 2.0f, 2.0f, "_Scale2"); //iPhone retina fparams.AddResolutionLevel(1024.0f, 1.0f, 1.0f, ""); //iPad // fparams.AddResolutionLevel(1280.0f, 2.0f, 2.0f, "_Scale2"); //Nexus 7 // fparams.AddResolutionLevel(2048.0f, 4.0f, 4.0f, "_Scale4"); //iPad Retina fparams.origin = new Vector2(0.5f, 0.5f); Futile.instance.Init(fparams); Futile.atlasManager.LoadAtlas("Atlases/SFB"); Futile.atlasManager.LoadAtlas("Atlases/SFB_en"); Futile.atlasManager.LoadFont("font", "font", "Atlases/font", 0, 0); _stage = Futile.stage; GoToPage(PageType.MenuPage); _stage.ListenForUpdate(HandleUpdate); }