public void GoToScreen(int screen) { foreach (GameObject s in m_Screens) { s.SetActive(false); } AudioManager.Instance.PlaySoundEvent(SOUNDID.MENU_CLICK); m_PreviousScreen = m_CurrentScreen; m_CurrentScreen = screen; m_Screens[m_PreviousScreen].SetActive(true); m_Screens[m_CurrentScreen].SetActive(true); m_bScreenAnimate = m_PreviousScreen != m_CurrentScreen; if (m_bScreenAnimate) { m_fScreenAnimateTimer = 0.0f; // Setting screen to correct position Vector3 prevPos = m_Screens[m_PreviousScreen].GetComponent <RectTransform>().localPosition; prevPos.x = 0.0f; m_Screens[m_PreviousScreen].GetComponent <RectTransform>().localPosition = prevPos; Vector3 currentPos = m_Screens[m_CurrentScreen].GetComponent <RectTransform>().localPosition; currentPos.x = m_PreviousScreen > m_CurrentScreen ? -m_fScreenWidth : m_fScreenWidth; m_Screens[m_CurrentScreen].GetComponent <RectTransform>().localPosition = currentPos; m_fScreenFrom = currentPos.x; } #if UNITY_IOS if (m_CurrentScreen == (int)eScreen.ACHIEVEMENTS) { GameObject btn = GameObject.FindGameObjectWithTag("Platform Specific Achievement Button"); if (btn != null) { btn.SetActive(false); } // GPManager.ShowAchievementsUI(); } #endif #if UNITY_ANDROID if (m_CurrentScreen == (int)eScreen.CREDITS) { ++m_CreditVisitNum; if (m_CreditVisitNum == 1) { GooglePlayService.ProgressAcheivement(GPGSIds.achievement_visit_credits_screen, 100.0f); } if (m_CreditVisitNum <= 5) { GooglePlayService.ProgressAcheivement(GPGSIds.achievement_visit_credits_screen_more, (float)m_CreditVisitNum / 5.0f * 100.0f); } } #endif }
void CheckCounters(ACHIEVEMENTSET[] arr, int currCount, ref int nextIndex) { while (currCount >= arr[nextIndex].count) { PrintObtainedText(arr[nextIndex]); #if UNITY_ANDROID // This will be multiple times as long as next index did not change if (arr[nextIndex].achievementID != "") { GooglePlayService.ProgressAcheivement(arr[nextIndex].achievementID, 100.0f); } #endif if (arr.Length > nextIndex + 1) { ++nextIndex; } else { break; } } #if UNITY_ANDROID int currentIndex = Math.Max(0, nextIndex - 1); // This will be multiple times as long as next index did not change //if ( arr[currentIndex].achievementID != "" ) //{ // GooglePlayService.ProgressAcheivement( arr[currentIndex].achievementID, 100.0f ); //} while (arr.Length > currentIndex + 1 && arr[++currentIndex].achievementID == "") { ; } if (arr[currentIndex].achievementID != "") { GooglePlayService.ProgressAcheivement(arr[currentIndex].achievementID, (float)currCount / arr[currentIndex].count); } #endif //SaveLoad.Save(); SaveDataLoader.SaveGame(); }