public void Install(ModuleManager manager) { manager.CreateCommands("", builder => { builder.CreateCommand("r") .Description("Rolls dice. Example formats: d20 d8 1d6 10d20 5*d100 8*2d20") .Parameter("roll", ParameterType.Unparsed) .Do(async e => { const int delayMs = 850; var data = e.GetArg("roll"); if (string.IsNullOrEmpty(data)) { await e.Channel.SendMessage("No roll given."); return; } // roll & display var view = new RollView(_rng, Roll.Parse(data)); var msg = await e.Channel.SendMessage(view.Draw()); while (!view.IsDone) { await Task.Delay(delayMs); view.Next(); await msg.Edit(view.Draw()); } }); }); }
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); if (PitchProperty.PropertyName.Equals(propertyName)) { PitchView.RotateTo(Pitch, 100, Easing.CubicInOut); } else if (YawProperty.PropertyName.Equals(propertyName)) { YawView.RotateTo(Yaw, 100, Easing.CubicInOut); } else if (RollProperty.PropertyName.Equals(propertyName)) { RollView.RotateTo(Roll, 100, Easing.CubicInOut); } }