public static void StartScrolling(VerticalScroller scroller, float scrollSpeed) { if (Mathf.Approximately(s_CurrentScrollerDestSpeed, scrollSpeed)) { return; } if (s_CurrentScrollerTween != null) { s_CurrentScrollerTween.Kill(); } float speedDiff = Mathf.Abs(scrollSpeed - scroller.GetScrollSpeed()); //Get to a speed of 10 units/sec in 1 second float timeToGetToScroll = speedDiff / 10f; s_CurrentScrollerDestSpeed = scrollSpeed; s_CurrentScrollerTween = DOTween.To(scroller.GetScrollSpeed, scroller.SetScrollSpeed, s_CurrentScrollerDestSpeed, timeToGetToScroll); s_CurrentScrollerTween.onComplete = () => s_CurrentScrollerTween = null; }
protected override void OnEnable() { base.OnEnable(); if (this.titleLabel == null) { Transform transform = this.dialogRoot.transform.Find("Title/Label"); if (transform != null) { this.titleLabel = transform.GetComponentsInChildren <TextMesh>(); } } Transform transform2 = this.dialogRoot.transform.Find("ListContainer"); this.leaderboardListScroller = transform2.GetComponent <VerticalScroller>(); Transform transform3 = this.dialogRoot.transform.Find("ListContainer/SingleRankGrid"); if (transform3 != null) { this.singleRanksGrid = transform3.GetComponent <GridLayout>(); } Transform transform4 = this.dialogRoot.transform.Find("ListContainer/Top50Grid"); if (transform4 != null) { this.top50Grid = transform4.GetComponent <GridLayout>(); } if (this.leaderboardEntries == null) { this.DecreaseLeaderboardScrollerHeight(this.top50Grid.VerticalGap); this.leaderboardEntries = new Dictionary <int, LeaderboardEntry>(); if (this.singleRanks != null) { int num = this.singleRanks.Length; } for (int i = 0; i < this.TotalEntryCount(); i++) { string name = string.Format("{0:0000}", i); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>((i < 50) ? this.entryPrefab : this.singleEntryPrefab); gameObject.transform.parent = ((i < 50) ? this.top50Grid.transform : this.singleRanksGrid.transform); gameObject.transform.SetAsLastSibling(); gameObject.name = name; LeaderboardEntry component = gameObject.transform.GetComponent <LeaderboardEntry>(); component.Init(this); component.ParentGrid = ((i < 50) ? this.top50Grid : this.singleRanksGrid); this.leaderboardEntries.Add(i, component); if (transform4 != null) { VerticalScrollButton component2 = gameObject.transform.GetComponent <VerticalScrollButton>(); component2.SetScroller(this.leaderboardListScroller); } } } this.UpdateGridLayout(); if (this.playerInfo == null) { transform2 = this.dialogRoot.transform.Find("PlayerInfoContainer"); VerticalScroller component3 = transform2.GetComponent <VerticalScroller>(); transform4 = transform2.Find("ReplayGrid"); if (transform4 != null) { this.replayGrid = transform4.GetComponent <GridLayout>(); } this.playerInfo = transform2.gameObject.AddComponent <LeaderboardPlayerInfo>(); for (int j = 0; j < 7; j++) { string name2 = string.Format("{0:0000}", j); GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.cakeRaceReplayEntryPrefab); gameObject2.transform.parent = this.replayGrid.transform; gameObject2.transform.SetAsLastSibling(); gameObject2.name = name2; CakeRaceReplayEntry component4 = gameObject2.transform.GetComponent <CakeRaceReplayEntry>(); component4.SetDialog(this); this.playerInfo.AddCakeRaceReplayEntry(j, component4); if (this.replayGrid != null && j > 0) { component3.AddHeight(this.replayGrid.VerticalGap); } } } this.replayGrid.UpdateLayout(); if (this.cupInfo == null) { transform2 = this.dialogRoot.transform.Find("CupInfoContainer"); this.cupInfo = transform2.gameObject.AddComponent <LeaderboardCupInfo>(); this.cupInfo.Init(this); } base.StartCoroutine(this.FetchLeaderboard()); this.SetTitle(this.GetCupAndSeasonTitle()); this.UpdateDaysLeft(); EventManager.Connect(new EventManager.OnEvent <UIEvent>(this.OnReceivedUIEvent)); }
// Use this for initialization public void Setup(VerticalScroller _scr) { Scrollr = _scr; stopsPlayer = LevelManager.LocalTuning.LinkedVertical.ScrollerStopper; }
void Start () { Instance = this; scrollView = GetComponent<UIScrollView>(); }
void OnDestroy() { Instance = null; }
public void SetScroller(VerticalScroller scroller) { this.vScroller = scroller; }
public void Setup(VerticalScroller _scr) { Scrollr = _scr; helpScrolling = LevelManager.LocalTuning.LinkedVertical.ScrollerHelper; }
// Use this for initialization public void Awake() { if (GameObject.Find("Frameworks") == null) { GameObject fmObj = Instantiate(Resources.Load("Presets/Frameworks")) as GameObject; fmObj.name = "Frameworks"; } if (GameObject.FindGameObjectWithTag("PlayerData") == null) { GameObject _dataplayer = Instantiate(Resources.Load("Presets/PlayerData")) as GameObject; _profile = _dataplayer.GetComponent<PlayerData>(); _profile.Launch(); } else { _profile = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>(); _profile.Launch(); } if (_profile.SETUP.GameType == GameSetup.versionType.Demo) { // Screen.SetResolution(800,600, false); // GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().pixelPerfectResolution = new Vector2(800f,600f); // GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().alwaysPixelPerfect = true; // GameObject.Find("Frameworks/OT/View").GetComponent<OTView>().customSize = 4; } GAMESTATE = _EditorState; _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>(); GlobTuning = Instantiate(Resources.Load("Tuning/Global")) as LPTuning; InputMan = Instantiate(Resources.Load("Tuning/InputManager")) as InputManager; CurrentLevelInfo = Instantiate(Resources.Load("Tuning/Levels/" + NAME)) as LevelInfo; LocalTuning = Instantiate(Resources.Load("Maps/" + NAME + "/Setup")) as LevelParameters; LocalTuning.initScript(); GameObject OutSpw = new GameObject("OuterSpawn"); OuterSpawn = OutSpw; OuterSpawn.transform.parent = FETool.findWithinChildren(this.gameObject, "Enviro").transform; OuterSpawn.transform.position = new Vector3(0f, -7.5f, 0f); tools = gameObject.AddComponent<LevelTools>(); tools._levMan = this; TranslateAllInScene(); CollectiblePlaces[] collecPla = FETool.findWithinChildren(this.gameObject, "Enviro/CollectiblePlaces").GetComponentsInChildren<CollectiblePlaces>(); foreach (CollectiblePlaces cpl in collecPla) { collecPlaces.Add(cpl); } Gate = GameObject.FindGameObjectWithTag("SpaceGate").GetComponent<SpaceGate>(); Gate.Setup(this); wpDirector = GetComponentInChildren<WaypointDirector>(); wpDirector.Setup(this); bricksMan = FETool.findWithinChildren(this.gameObject, "LevelBricks/Bricks").GetComponent<BricksManager>(); bricksMan.Setup(); if (GAMETYPE != LocalTuning.levelType) { Debug.Log("Type of LevelMana & Setup scrip arent't the same"); } GAMETYPE = LocalTuning.levelType; switch (GAMETYPE) { case LevelParameters.levelTypeList.Debuggin : { linearTrigger = gameObject.AddComponent<LinearStepTrigger>(); linearTrigger.Setup(this); break; } case LevelParameters.levelTypeList.Linear : { linearTrigger = gameObject.AddComponent<LinearStepTrigger>(); linearTrigger.Setup(this); break; } case LevelParameters.levelTypeList.Maze : { break; } case LevelParameters.levelTypeList.Procedural : { GameObject gameo = FETool.createGameObject("ProceduralManager", gameObject); ProcMana = gameo.AddComponent<Procedural>(); ProcMana.Setup(this); break; } case LevelParameters.levelTypeList.Vertical : { GameObject vm = new GameObject("VerticalManager"); VerticalManager = vm.AddComponent<VerticalScroller>(); vm.transform.parent = this.transform; VerticalManager.Setup(this); break; } } wpDirector.affectRelatedBricks(bricksMan.BricksList); if (LocalTuning.levelType != LevelParameters.levelTypeList.Debuggin) { if (GameObject.Find("UI") == null) { GameObject uiman = Instantiate(Resources.Load("Presets/UI")) as GameObject; uiman.name = "UI"; menuManager = uiman.GetComponent<MainMenu>(); } else { menuManager = GameObject.Find("UI").GetComponent<MainMenu>(); } } if (menuManager != null) { menuManager.Setup(this); } managerChecker(); // proc.triggerStep(proc._listSteps[0]); _player.Setup(); Setup(); }