public SpeedTrainerHud(ScreenManager screenManager, Metronome metronome, Rectangle rect) : base(screenManager, metronome, rect) { // Initialize Texts mTexts = new [,]{{"Increase By", "BMP"},{"Increase After", "Bars"},{ "Increase Up To", "BMP"}}; mTextPositions = new Vector2[mTexts.GetLength(0)]; for (var i = 0; i < mTexts.GetLength(0); i++) { var xpos = mRectangle.X + 10; var ypos = mRectangle.Y + 70 + i * 40; mTextPositions[i] = new Vector2(xpos, ypos); } // Initialize TextBoxes mTextBoxes = new TextBox[mTexts.GetLength(0)]; for (var i = 0; i < mTextBoxes.Length; i++) { mTextBoxes[i] = new TextBox(new Rectangle(mRectangle.X + mRectangle.Width - 120, (int) mTextPositions[i].Y, 60, 25), true); } mTextBoxes[0].SetDefaultText("10"); mTextBoxes[1].SetDefaultText("8"); mTextBoxes[2].SetDefaultText("200"); // Initialize values from Metronome mTextBoxes[0].SetText(mMetronome.mIncreaseBy.ToString()); mTextBoxes[1].SetText(mMetronome.mIncreaseAfter.ToString()); mTextBoxes[2].SetText(mMetronome.mIncreaseUpTo.ToString()); }
public MetronomeScreen(ScreenManager screenManager, ContentManager content) { mContent = content; mMetronome = File.Exists("savedata.txt") ? SaveData.GetInstance().Load("savedata.txt") : new Metronome(); mScreenManager = screenManager; mRectangle = new Rectangle(0, 0, Game.mScreenWidth, Game.mScreenHeight); // Initialize other screens const int width = 300; const int height = 200; var rect = new Rectangle(Game.mScreenWidth / 2 - width / 2, Game.mScreenHeight / 2 - height / 2, width, height); mSpeedTrainerHud = new SpeedTrainerHud(mScreenManager, mMetronome, rect); mStopHud = new StopHud(mScreenManager, mMetronome, rect); mSideBar = new SideBar(mScreenManager, mContent, mMetronome, new Rectangle(0, 0, Game.mScreenWidth / 5, Game.mScreenHeight)); // Initialize buttons RunAction[] actions = { mMetronome.Resume, mMetronome.Pause, mMetronome.Stop, null, null, null, null, mMetronome.ToggleAutoStop, mMetronome.ToggleAutoIncrease }; RunAction[] rightActions = {ShowStopHud, ShowSpeedTrainerHud}; string[] names = {"Play", "Pause", "Stop", "Increase", "Decrease", "Increase10", "Decrease10", "StopMode", "SpeedMode"}; int[] parameters = {1, -1, 10, -10}; mButtons = new Button[actions.Length]; for (var i = 0; i < mButtons.Length; i++) { mButtons[i].mTexName = names[i]; mButtons[i].mState = OwnButtonState.Normal; mButtons[i].mAction = actions[i]; mButtons[i].mTextures = new Texture2D[3]; if (i > 2 && i < 7) { mButtons[i].mParameterAction = mMetronome.ChangeTempoBy; mButtons[i].mParameter = parameters[i - 3]; } else if (i >= 7) { mButtons[i].mActionRight = rightActions[i-7]; } } var size = 64; mButtons[0].mRectangle = new Rectangle((int)(mRectangle.Width / 2f - (size + 10)), 20, size, size); mButtons[1].mRectangle = mButtons[0].mRectangle; mButtons[2].mRectangle = new Rectangle((int) (mRectangle.Width / 2f + 10), 20, size, size); size = 32; mButtons[3].mRectangle = new Rectangle((int)(mRectangle.Width / 2f - (size + 50)), 470, size, size); mButtons[4].mRectangle = new Rectangle((int)(mRectangle.Width / 2f + 50), 470, size, size); mButtons[5].mRectangle = new Rectangle((int)(mRectangle.Width / 2f - (size + 50)), 520, size, size); mButtons[6].mRectangle = new Rectangle((int)(mRectangle.Width / 2f + 50), 520, size, size); size = 50; mButtons[7].mRectangle = new Rectangle((int)(mRectangle.Width / 2f - (size + 130)), 490, size, size); mButtons[8].mRectangle = new Rectangle((int)(mRectangle.Width / 2f + 130), 490, size, size); mButtons[0].mInvisible = mMetronome.mPlayState == Metronome.PlayState.Playing; mButtons[1].mInvisible = mMetronome.mPlayState != Metronome.PlayState.Playing; mIsPointerLeft = true; }
public void updateFallingGuyAndMoveApart(Metronome metronome, float time) { scrollFall(); if (metronome.currentTick(time) < 30) { moveArmsApart(); } }
private void BeatContainer_Init() { this.iBeatCounter = Substitute.For <IBeatCounter>(); this.iBeatCounter.BarLength.Returns(4f); this.iBeatCounter.Bpm.Returns(60f); this.iMetronome = Substitute.For <IMetronome>(); this.metronome = new Metronome(4f); }
static void Main() { Metronome m = new Metronome(); Listener l = new Listener(); l.Subscribe(m); m.Start(); }
private void Start() { _metronome = FindObjectOfType <Metronome>(); _iniPos = transform.position; _iniScale = transform.localScale; _scale = _iniScale + Vector3.up * 1.4f; }
public override void Setup(float startTime) { background.Show(); this.startTime = startTime; animation = new Metronome(startTime, 0.1f); fallingGuyProp.Setup(); fallingGuyProp.ensureArmIsOnLeftOfScreen(); }
public MainForm() { InitializeComponent(); metronome = new Metronome(); metronome.SynchronizingObject = lbManualTempo; metronome.TempoDetected += metronome_TempoDetected; }
/// <summary> /// Gets a color from color wheel based on index and rgbSeed. /// </summary> /// <param name="index">Index of the layer</param> /// <param name="saturation">Saturation value</param> /// <returns></returns> public static CGColor ColorWheel(int index, float saturation = 1f) { if (!seedSet) { RgbSeed = Metronome.GetRandomNum(); seedSet = true; } int degrees = ((25 * index) + (int)(360 * RgbSeed / 100)) % 360; nfloat min = 1 - saturation; int degreesMod = degrees == 0 ? 0 : degrees % 60 == 0 ? 60 : degrees % 60; nfloat stepSize = (1 - min) / 60; nfloat red, green, blue; if (degrees <= 60) { red = 1; green = min + degreesMod * stepSize; blue = min; } else if (degrees <= 120) { red = 1 - degreesMod * stepSize; green = 1; blue = min; } else if (degrees <= 180) { red = min; green = 1; blue = min + degreesMod * stepSize; } else if (degrees <= 240) { red = min; green = 1 - degreesMod * stepSize; blue = 1; } else if (degrees <= 300) { red = min + degreesMod * stepSize; green = min; blue = 1; } else { red = 1; green = min; blue = 1 - degreesMod * stepSize; } return(new CGColor( red, green, blue, 1 )); }
/// <summary> /// Initializes all required modules for the game. /// </summary> protected virtual void InitializeModules() { UnityThread.Initialize(); Dependencies.CacheAs <IGame>(this); Dependencies.CacheAs <IPlatformHost>(platformHost = PlatformHost.CreateHost()); Dependencies.CacheAs <DeepLinker>(deepLinker = platformHost.CreateDeepLinker()); Dependencies.CacheAs <IEnvConfiguration>(envConfiguration = new EnvConfiguration(EnvType.Production)); Dependencies.CacheAs <IModeManager>(modeManager = new ModeManager()); Dependencies.CacheAs <INotificationBox>(notificationBox = new NotificationBox()); Dependencies.CacheAs <IGameConfiguration>(gameConfiguration = new GameConfiguration()); Dependencies.CacheAs <IMapConfiguration>(mapConfiguration = new MapConfiguration()); Dependencies.CacheAs <IMapsetConfiguration>(mapsetConfiguration = new MapsetConfiguration()); Dependencies.CacheAs <IFontManager>(fontManager = new FontManager()); Dependencies.CacheAs <IAtlas <Sprite> >(spriteAtlas = new ResourceSpriteAtlas()); Dependencies.CacheAs <IAtlas <AudioClip> >(audioAtlas = new ResourceAudioAtlas()); Dependencies.CacheAs <IMusicCacher>(musicCacher = new MusicCacher()); Dependencies.CacheAs <IBackgroundCacher>(backgroundCacher = new BackgroundCacher()); Dependencies.CacheAs <IWebImageCacher>(webImageCacher = new WebImageCacher()); Dependencies.CacheAs <IWebMusicCacher>(webMusicCacher = new WebMusicCacher()); Dependencies.CacheAs <IMusicController>(musicController = MusicController.Create()); Dependencies.CacheAs <ISoundTable>(soundTable = new DefaultSoundTable(audioAtlas)); Dependencies.CacheAs <ISoundPool>(soundPool = new SoundPool(soundTable)); Dependencies.CacheAs <IMapsetStore>(mapsetStore = new MapsetStore(modeManager)); Dependencies.CacheAs <IMapSelection>(mapSelection = new MapSelection(musicCacher, backgroundCacher, gameConfiguration, mapsetConfiguration, mapConfiguration)); Dependencies.CacheAs <IMapManager>(mapManager = new MapManager(mapsetStore, notificationBox, mapSelection)); Dependencies.CacheAs <IMetronome>(metronome = new Metronome() { AudioController = musicController }); Dependencies.CacheAs <IMusicPlaylist>(musicPlaylist = new MusicPlaylist()); Dependencies.CacheAs <IDownloadStore>(downloadStore = new DownloadStore()); Dependencies.CacheAs <IApi>(api = new Api(envConfiguration, notificationBox, deepLinker)); Dependencies.CacheAs <IUserManager>(userManager = new UserManager(api, Dependencies)); Dependencies.CacheAs <IRecordStore>(recordStore = new RecordStore()); Dependencies.CacheAs <IRootMain>(rootMain = RootMain.Create(Dependencies)); Dependencies.CacheAs <IRoot3D>(root3D = Root3D.Create(Dependencies)); Dependencies.CacheAs <IColorPreset>(colorPreset = new ColorPreset()); Dependencies.CacheAs <IAnimePreset>(animePreset = new AnimePreset()); Dependencies.CacheAs <IScreenNavigator>(screenNavigator = new ScreenNavigator(rootMain)); Dependencies.CacheAs <IOverlayNavigator>(overlayNavigator = new OverlayNavigator(rootMain)); Dependencies.CacheAs <IDropdownProvider>(dropdownProvider = new DropdownProvider(rootMain)); Dependencies.CacheAs <ITemporaryStore>(temporaryStore = new TemporaryStore()); }
/// <summary> /// </summary> public EditorScreen(Qua map) { if (OnlineManager.IsSpectatingSomeone) { OnlineManager.Client?.StopSpectating(); } OriginalMap = map; WorkingMap = ObjectHelper.DeepClone(OriginalMap); FixInvalidHitObjectLayers(); MapManager.Selected.Value.Qua = WorkingMap; // Discord Rich Presence DiscordHelper.Presence.Details = WorkingMap.ToString(); DiscordHelper.Presence.State = "Editing"; DiscordHelper.Presence.StartTimestamp = (long)(TimeHelper.GetUnixTimestampMilliseconds() / 1000); DiscordHelper.Presence.EndTimestamp = 0; DiscordRpc.UpdatePresence(ref DiscordHelper.Presence); ActiveLayerInterface = new Bindable <EditorLayerInterface>(EditorLayerInterface.Composition) { Value = EditorLayerInterface.Composition }; ModManager.RemoveSpeedMods(); if (!LoadAudioTrack()) { return; } CustomAudioSampleCache.LoadSamples(MapManager.Selected.Value, MapManager.Selected.Value.Md5Checksum); SetHitSoundObjectIndex(); GameBase.Game.IsMouseVisible = true; GameBase.Game.GlobalUserInterface.Cursor.Visible = false; GameBase.Game.Window.FileDropped += OnFileDropped; if (MapManager.Selected.Value.Game == MapGame.Quaver) { BeginWatchingFiles(); } Metronome = new Metronome(WorkingMap); View = new EditorScreenView(this); CreateRuleset(); AppDomain.CurrentDomain.UnhandledException += OnCrash; if (File.Exists($"{ConfigManager.SongDirectory}/{MapManager.Selected.Value.Directory}/{MapManager.Selected.Value.Path}.autosave")) { DialogManager.Show(new EditorAutosaveDetectionDialog()); } }
void Start() { Metronome metronome = FindObjectOfType <Metronome>(); if (metronome != null) { metronome.RegisterBeatListener(this); } }
static void Main(string[] args) { Metronome m = new Metronome(); Listener l = new Listener(); l.Subscribe(m); m.Start(); //Console.ReadKey(); }
public void Pour(float time) { createConfettiPieces(); setRandomFallSpeeds(); pouring = true; startedPouring = time; pouringAnimationFrequency = new Metronome(time, 0.125f); }
public void handleMessage(MetaMessage metaMessage, MidiInterpreter midi, Score score) { byte[] tempoBytes = metaMessage.GetBytes(); int tempo = (tempoBytes[0] & 0xff) << 16 | (tempoBytes[1] & 0xff) << 8 | (tempoBytes[2] & 0xff); var bpm = 60000000 / tempo; var metronome = new Metronome(Length.Quarter, bpm); score.staffsInScore.Last().bars.Last().notes.Add(metronome); }
public override void Update() { if (showingFallingGuy) { var armWasNotToTheLeft = !fallingGuyProp.armIsOnLeftOfScreen(); fallingGuyProp.updateFallingGuy(armMovement); if (armWasNotToTheLeft && fallingGuyProp.armIsOnLeftOfScreen()) { sceneManager.changeSceneLength(16f); endScene(); } return; } armSwinger.Update(); if (gripReleased) { if (armMovement.currentTick(Time.time) > 2) { // cut to guy falling hideLargeSceneProps(); showFallingGuy(); } if (armMovement.isNextTick(Time.time)) { moveTopArmUp(); } return; } if (openFingers.Length == nextFinger) { solvedScene(); gripReleased = true; armMovement = new Metronome(Time.time, 0.1f); return; } if (touchSensor.insideSprite(Camera.main, topHand) || touchSensor.insideSprite(Camera.main, indexClosed)) { openFingers[nextFinger].visible(true); if (nextFinger < 4) { armSwinger.swing(Time.time); } if (openFingers[nextFinger] == indexOpen) { indexClosed.visible(false); } nextFinger++; } }
public IEnumerator DelayBeats(Metronome metro, float beat) { float start = Mathf.Floor(metro.currentTiming.totalBeats); while (metro.currentTiming.totalBeats < start + beat) { yield return(null); } }
public static void EH_Main_2() { /* https://www.codeproject.com/Articles/11541/The-Simplest-C-Events-Example-Imaginable */ Metronome m = new Metronome(); Listener l = new Listener(); l.Subscribe(m); m.Start(); }
void OnDestroy() { Metronome metronome = FindObjectOfType <Metronome>(); if (metronome != null) { metronome.UnregisterBeatListener(GetComponent <BeatListener>()); } }
void OnDestroy() { if (Metronome.DoesExist()) { Metronome.instance.SignalBeat -= OnBeat; Metronome.instance.SignalMeasure -= OnMeasure; Metronome.instance.SignalPhrase -= OnPhrase; Metronome.instance.SignalSixteenth -= OnSixteenth; } }
public void Visit(Metronome metronome) { int speed = (60000000 / metronome.getBeatsPerMinute().Last()); byte[] tempo = new byte[3]; tempo[0] = (byte)((speed >> 16) & 0xff); tempo[1] = (byte)((speed >> 8) & 0xff); tempo[2] = (byte)(speed & 0xff); MetaTrack.Insert(PreviousNoteAbsoluteTicks, new MetaMessage(MetaType.Tempo, tempo)); }
public override void Setup(float startTime) { endScene(); videoSpeed = new Metronome(startTime, 0.33333333f); videoClip.SetActive(true); videoSprite = videoClip.GetComponent<Sprite>(); videoSprite.setScreenPosition(0, 0); }
public override void Setup(float startTime) { endScene(); videoSpeed = new Metronome(startTime, 0.33333333f); videoClip.SetActive(true); videoSprite = videoClip.GetComponent <Sprite>(); videoSprite.setScreenPosition(0, 0); }
public void Setup() { letters = new Sprite[numberOfBottomPieces]; leftLetters = new Sprite[numberOfPiecesPerSide]; rightLetters = new Sprite[numberOfPiecesPerSide]; letterAtlas = (Texture2D)Resources.Load("TodoList/ksLetters"); createLetterRow(0); scrollingFrequency = new Metronome(Time.time, 0.125f); }
// Start is called before the first frame update void Start() { metronome = Metronome.Instance; position = new Vector3(); position.y = 0.0F; position.z = 0.0F; scoreWidth = timingBar.parent.GetComponent <RectTransform>().rect.width; barOffset = timingBar.anchorMin.x; Debug.Log(scoreWidth); }
public static void updateBPM(Metronome m) //Met à jour le BPM dans tous les éléments nécessaires { foreach (TextMeshProUGUI txt in m.txtBPM) { txt.text = "BPM : " + BPM; } m.beatsPerMinute = BPM; m.tabExo.beatTempo = BPM / 60f; m.sdrBPM.value = BPM; }
void startPlay() { step = (float)1 / HoneyCombConstant.loopLength; //1/(bpm/60)/8; stepTime = step * 1 / (HoneyCombConstant.bpm / 60); transform.position = circularPath[0]; var duration = HoneyCombConstant.loopLength * Metronome.SecondPerBeat(HoneyCombConstant.bpm); var t = transform.DOPath(circularPath, duration).SetLoops(-1).SetEase(Ease.Linear).OnUpdate(looperUpdate); //60bpm 1beat 1sec }
public void Setup() { letters = new Sprite[numberOfBottomPieces]; leftLetters = new Sprite[numberOfPiecesPerSide]; rightLetters = new Sprite[numberOfPiecesPerSide]; letterAtlas = (Texture2D) Resources.Load("TodoList/ksLetters"); createLetterRow(0); scrollingFrequency = new Metronome(Time.time, 0.125f); }
public IEnumerator WaitForBeatInMeasure(Metronome metro, float beat) { while (Mathf.Floor(metro.currentTiming.beats) > beat) { yield return(null); } while (metro.currentTiming.beats < beat) { yield return(null); } }
public StopSettings(bool onBeat, Metronome metronome, SnapStyle snapStyle, float beat, float delay, float fadeLength, FadeType fadeType, float power) { this.onBeat = onBeat; this.metronome = metronome; this.snapStyle = snapStyle; this.beat = beat; this.delay = delay; this.fadeLength = fadeLength; this.fadeType = fadeType; this.power = power; }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
static void Main() { //为了容易设置,以防在当前时间之前 Console.WriteLine("当前时间为:"); Console.WriteLine(DateTime.Now); //注册事件 Metronome m = new Metronome(); m.Start(); Console.ReadLine(); }
void Awake() { _metronome = new Metronome(HighResTime.UtcNow, 60 * HighResTime.SECOND2TICK / tempo, loop); _metronome.Update(); _lastX = _metronome.x; _cubeInfos = new CubeInfo[loop, height]; _cubeLayerMask = (1 << LayerMask.NameToLayer("CubeMatrix")); _audioSources = new AudioSource[nAudioBuffers * height]; for (var i = 0; i < _audioSources.Length; i++) _audioSources[i] = gameObject.AddComponent<AudioSource>(); }
void Start() { if (instance == null) { instance = this; } else { DestroyImmediate(this); } }
static void Main() { // setup the metronome and make sure the EventHandler delegate is ready Metronome metronome = new Metronome(); // wires up the metronome_Tick method to the EventHandler delegate Listener listener = new Listener(metronome); ListenerB listenerB = new ListenerB(metronome); metronome.Go(); }
private void OnGameStarted() { if (Metronome.metronomeStarted == false) { StartCoroutine(Metronome.StartMetronome()); } else { Metronome.metronomePaused = false; } }
public EditSpeedTemplateHud(ScreenManager screenManager, Metronome metronome, Rectangle rect) : base(screenManager, metronome, rect) { // Initialize basic buttons "Ok" and "Close" that should be displayed on every HUD. var tmpButtons = new Button[mButtons.Length + 1]; tmpButtons[0] = mButtons[0]; tmpButtons[1] = mButtons[1]; tmpButtons[2].mTexName = "Delete"; tmpButtons[2].mState = OwnButtonState.Normal; tmpButtons[2].mAction = Delete; tmpButtons[2].mTextures = new Texture2D[3]; tmpButtons[2].mRectangle = new Rectangle(mRectangle.Width + 5, mRectangle.Height + 5, 32, 32); mButtons = tmpButtons; }
public StopHud(ScreenManager screenManager, Metronome metronome, Rectangle rect) : base(screenManager, metronome, rect) { // Initialize Texts mTexts = new[,] { { "Stop After", "Bars" }}; mTextPositions = new Vector2[1]; mTextPositions[0] = new Vector2(mRectangle.X + 10, mRectangle.Y + 70); // Initialize TextBoxes mTextBoxes = new TextBox[1]; mTextBoxes[0] = new TextBox(new Rectangle(mRectangle.X + mRectangle.Width - 120, (int)mTextPositions[0].Y, 60, 25), true); mTextBoxes[0].SetDefaultText("100"); // Initialize Values from Metronome mTextBoxes[0].SetText(mMetronome.mStopAfter.ToString()); }
public SpeedTemplateHud(ScreenManager screenManager, Metronome metronome) { var width = Game.mScreenWidth / 5; var height = Game.mScreenHeight; mRectangle = new Rectangle(Game.mScreenWidth - width, 0, width, height); mScreenManager = screenManager; mMetronome = metronome; mSpeedTemplate = mMetronome.mCurrentTemplate; // Initialize the statement values var templateString = mSpeedTemplate.ToString(); mStatements = new string[templateString.Count(x => x == '.')]; mStatementPos = new Vector2[mStatements.Length]; mBars = new int[mStatements.Length][]; var i = 0; for (var j = 0; j < mStatements.Length; j++) { if ((templateString.IndexOf('.', i)) == -1) break; // initialize string var strLength = (templateString.IndexOf('.', i)) - i; mStatements[j] = mSpeedTemplate.ToString().Substring(i, strLength); if (mStatements[j][0] == 'r') { mStatements[j] = mStatements[j].Substring(1); } // initialize position mStatementPos[j] = new Vector2(mRectangle.X + 45, 40 + j*20); // initialize number of bars mBars[j] = new int[3]; mBars[j][0] = int.Parse(mStatements[j].Substring(0, mStatements[j].IndexOf('x'))); if (mStatements[j].Count(x => x == 'x') > 1) { var startIndex = mStatements[j].LastIndexOf('x') + 1; mBars[j][1] = int.Parse(mStatements[j].Substring(startIndex, mStatements[j].Length - startIndex)); mBars[j][2] = mBars[j][0] * mBars[j][1]; } else { mBars[j][1] = 0; mBars[j][2] = mBars[j][0]; } i = templateString.IndexOf('.', i) + 1; } }
/// <summary> /// The following coroutines are used to snap playing & stopping to the beat. /// </summary> public IEnumerator DelayAndSnap(Metronome metro, SnapStyle snap, float beat, float delay) { if (delay > 0f) { yield return StartCoroutine (DelayBeats (metro, delay)); } switch (snap) { case SnapStyle.BeatInMeasure: yield return StartCoroutine (WaitForBeatInMeasure (metro, beat)); break; case SnapStyle.BeatValue: yield return StartCoroutine (WaitForBeatValue (metro, beat)); break; } }
public CreateSpeedTemplateHud(ScreenManager screenManager, Metronome metronome, Rectangle rect) : base(screenManager, metronome, rect) { // Initialize Texts mTexts = new[,] {{"Name", ""}, {"Speed Template", ""}}; mTextPositions = new Vector2[2]; mTextPositions[0] = new Vector2(mRectangle.X + 10, mRectangle.Y + 70); mTextPositions[1] = new Vector2(mRectangle.X + 10, mRectangle.Y + 110); // Initialize TextBoxes mTextBoxes = new TextBox[2]; mTextBoxes[0] = new TextBox(new Rectangle(mRectangle.X + (mRectangle.Width - 160), (int)mTextPositions[0].Y, 150, 25), maxTextLength: 20); mTextBoxes[1] = new TextBox(new Rectangle(mRectangle.X + 10, (int)mTextPositions[1].Y + 30, (mRectangle.Width - 20), 25), maxTextLength: 150); mTextBoxes[1].UseSmallFont(true); mTextBoxes[0].SetDefaultText("new template"); }
protected Hud(ScreenManager screenManager, Metronome metronome, Rectangle rect) { mScreenManager = screenManager; mMetronome = metronome; mRectangle = rect; // Initialize basic buttons "Ok" and "Close" that should be displayed on every HUD. var actions = new MetronomeScreen.RunAction[] { Ok, Close }; var names = new[] { "Ok", "Close" }; Initialize(actions, names); var size = 32; mButtons[0].mRectangle = new Rectangle(mRectangle.X + mRectangle.Width - (size * 2 + 20), mRectangle.Y + 5, size, size); mButtons[1].mRectangle = new Rectangle(mRectangle.X + mRectangle.Width - (size + 10), mRectangle.Y + 5, size, size); }
public SideBar(ScreenManager screenManager, ContentManager content, Metronome metronome, Rectangle rect) : base(screenManager, metronome, rect) { mContent = content; // Initialize other screens const int width = 300; const int height = 200; var rectangle = new Rectangle(Game.mScreenWidth / 2 - width / 2, Game.mScreenHeight / 2 - height / 2, width, height); mCreateSpeedTemplateHud = new CreateSpeedTemplateHud(mScreenManager, mMetronome, rectangle); mCreateRudimentHud = new CreateRudimentHud(mScreenManager, mMetronome, rectangle); mEditSpeedTemplateHud = new EditSpeedTemplateHud(mScreenManager, mMetronome, rectangle); // Initialize Create buttons var labels = new[] {"New Template", "New Rudiment"}; var actions = new MetronomeScreen.RunAction[] {CreateNewTemplate, CreateNewRudiment}; mButtons = new Button[labels.Length + mMetronome.mSpeedTemplates.Count]; for (var i = 0; i < labels.Length; i++) { mButtons[i].mLabel = labels[i]; mButtons[i].mTexName = "TextButton"; mButtons[i].mState = OwnButtonState.Normal; mButtons[i].mAction = actions[i]; mButtons[i].mTextures = new Texture2D[3]; } mButtons[0].mRectangle = new Rectangle(mRectangle.X + 10, mRectangle.Y + 40 + mMetronome.mSpeedTemplates.Count*30, 100, 25); mButtons[1].mRectangle = new Rectangle(mRectangle.X + 10, mButtons[0].mRectangle.Y + 80 + mMetronome.mRudiments.Count*30, 100, 25); // Initialize Speed Template buttons for (var i = 2; i - 2 < mMetronome.mSpeedTemplates.Count; i++) { mButtons[i].mLabel = mMetronome.mSpeedTemplates[i - 2].mName; mButtons[i].mTexName = "TextButtonBlue"; mButtons[i].mState = OwnButtonState.Normal; mButtons[i].mParameterAction = StartTemplate; mButtons[i].mParameterActionRight = EditTemplate; mButtons[i].mParameter = i - 2; mButtons[i].mTextures = new Texture2D[3]; mButtons[i].mRectangle = new Rectangle(10, 40 + (i - 2) * 30, 100, 20); } }
public void Setup(float startTime) { metronome = new Metronome(startTime, 0.125f); confetti.ensureConfettiWasPoured(); scrollingLetters = new ScrollingLetters(); scrollingLetters.Setup(); }
public StopSettings(Metronome metronome, SnapStyle snapStyle, float beat, float delay, float fadeLength, FadeType fadeType, float power) : this(true, metronome, snapStyle, beat, delay, fadeLength, fadeType, power) { }
public StopSettings(Metronome metronome, float beat, float fadeLength) : this(true, metronome, SnapStyle.BeatValue, beat, 0f, fadeLength, FadeType.Lin, 1f) { }
void Start() { floor = gameObject.transform.position.y; metronome = metronomeObj.GetComponent<Metronome>(); beat = metronome.GetBeat(); velocity = (4f*highestPoint)/beat; grav = (-velocity) / beat; anim = gameObject.GetComponent<Animator>(); }
public override void Setup(float startTime) { endScene(); background.visible(true); shoe.SetActive(true); amp.SetActive(true); wires.SetActive(true); wireShadow.SetActive(true); stompSpeed = new Metronome(startTime, 0.1f); }
static void Main() { Metronome m = new Metronome(); Clock c = new Clock(); Listener l1 = new Listener(); Listener l2 = new Listener(); l1.Subscribe(m, "sup"); l2.Subscribe(m, "homi"); m.Start(); // unfortunately these are synchronous //c.Start(); }
private void HeardIt(Metronome m, TimeOfTick e) { System.Console.WriteLine(msg + ": HEARD METRO AT {0}",e.Time); }
public CreateRudimentHud(ScreenManager screenManager, Metronome metronome, Rectangle rect) : base(screenManager, metronome, rect) { mButtons = new Button[0]; }
public void swing(float time) { swinging = true; swingInterval = new Metronome(time, 0.1f); }
public void Update() { if (swinging && swingInterval.isNextTick(Time.time)) { if (swingInterval.nextTick < swingLength) swingPivot.transform.Rotate(0f, 0f, swingIncrement); else if (swingInterval.nextTick >= swingLength && swingInterval.nextTick < swingLength * 2) swingPivot.transform.Rotate(0f, 0f, -swingIncrement); else if (swingInterval.nextTick == swingLength * 2) { swinging = false; swingInterval = new Metronome(Time.time, 0.1f); } } }
void Awake() { _instance = this; }
public override void Update() { if (showingFallingGuy) { var armWasNotToTheLeft = !fallingGuyProp.armIsOnLeftOfScreen(); fallingGuyProp.updateFallingGuy(armMovement); if(armWasNotToTheLeft && fallingGuyProp.armIsOnLeftOfScreen()) { sceneManager.changeSceneLength(16f); endScene(); } return; } armSwinger.Update(); if (gripReleased) { if (armMovement.currentTick(Time.time) > 2) { // cut to guy falling hideLargeSceneProps(); showFallingGuy(); } if (armMovement.isNextTick(Time.time)) { moveTopArmUp(); } return; } if (openFingers.Length == nextFinger) { solvedScene(); gripReleased = true; armMovement = new Metronome(Time.time, 0.1f); return; } if (touchSensor.insideSprite(Camera.main, topHand) || touchSensor.insideSprite(Camera.main, indexClosed)) { openFingers[nextFinger].visible(true); if (nextFinger < 4) { armSwinger.swing(Time.time); } if (openFingers[nextFinger] == indexOpen) { indexClosed.visible(false); } nextFinger++; } }
// Use this for initialization void Start() { this.metronome = GameObject.FindGameObjectWithTag(SceneConstants.metronomeTag).GetComponent<Metronome>(); this.audioSource = gameObject.GetComponent<AudioSource>(); this.originalScale = transform.localScale; this.SetRhythm((int)this.stepsPulses.x, (int)this.stepsPulses.y); }
public ArmSwinger(float startTime, GameObject swingPivot) { swingInterval = new Metronome(startTime, 0.1f); this.swingPivot = swingPivot; }
void Start () { metronome = GameObject.Find ("Metronome").GetComponent<Metronome> (); metronome.OnNewMeasure += Store; }