async Task OnSay(Say msg, IOperationContext context) { if (_room != null) { await _room.Say(new SayS2S() { UserName = _userName, Text = msg.Text }); } else throw new ProcessingException(SayErrors.NotConnectedToRoom); }
void OnSay(Say msg, IOperationContext context) { if (_room != null) { _room.SendOneWay(new SayS2S(){UserName = _userName, Text = msg.Text}, context); } else throw new ProcessingException(SayErrors.NotConnectedToRoom); }
public string SayHello(string name, Say fun) { string r = ""; //r += EnHello(name); //r += ZhHello(name); //r = fun(name); r = fun(name); return r; }
public void Talk(Say say) { //player.URL = GetSayPath(say); Players[0].SoundLocation = GetSayPath(say); Players[0].Play(); /* lastuse = lastuse == 0 ? 1 : 0; SoundPlayer Playtemp = Players[lastuse]; Playtemp.Stop(); Playtemp.SoundLocation = GetSayPath(say);*/ }
/// <summary> /// Directly say something possibly as another user (skips all checks) /// </summary> public async Task GhostSay(Say say, int?battleID = null) { if (say.Time == null) { say.Time = DateTime.UtcNow; } switch (say.Place) { case SayPlace.Channel: Channel channel; if (Channels.TryGetValue(say.Target, out channel)) { await SyncAndSay(channel.Users.Keys, say); } OfflineMessageHandler.StoreChatHistoryAsync(say); break; case SayPlace.User: ConnectedUser connectedUser; if (ConnectedUsers.TryGetValue(say.Target, out connectedUser)) { await SyncAndSay(new List <string>() { say.Target }, say); } else { OfflineMessageHandler.StoreChatHistoryAsync(say); } if (say.User != GlobalConst.NightwatchName && ConnectedUsers.TryGetValue(say.User, out connectedUser)) { await connectedUser.SendCommand(say); } break; case SayPlace.Battle: ServerBattle battle; if (Battles.TryGetValue(battleID ?? 0, out battle)) { await SyncAndSay(battle.Users.Keys, say); await battle.ProcessBattleSay(say); OfflineMessageHandler.StoreChatHistoryAsync(say); } break; // admin AH sent only: case SayPlace.MessageBox: await Broadcast(ConnectedUsers.Values, say); break; case SayPlace.BattlePrivate: ConnectedUser targetUser; if (ConnectedUsers.TryGetValue(say.Target, out targetUser)) { await targetUser.SendCommand(say); } break; } await OnSaid(say); }
/// <summary> /// 更新一条数据 /// </summary> public void UpdateSay(Say entity) { linqHelper.UpdateEntity <Say>(entity); }
public virtual void Say(Say how_say, string text) { if (text == null) throw new ArgumentNullException ("text"); Crit_Say(thisptr, (byte)how_say, text); }
public override string Arm(ServerBattle battle, Say e, string arguments = null) { cmd = arguments; return($"do you want to host say {cmd} ?"); }
public bool AddTextListener(Say say_type, string first_str, ushort parameter, string script_name) { return Global_AddTextListener((int)say_type, new ScriptString(first_str).ThisPtr, parameter, CoreUtils.ParseFuncName(script_name).ThisPtr); }
public virtual void Say(Say how_say, string text) { var ss = new ScriptString(text); Crit_Say(thisptr, (byte)how_say, ss.ThisPtr); }
public void Fourteen() { Assert.Equal("fourteen", Say.InEnglish(14L)); }
public SaySound(Say say) { Say = say; Sounds = new Dictionary<int, string>(); }
private void OnSay(Say e) { richTextBox1.AppendText(string.Format( ">{0} say \t{1} from:{2}\r\n {3}\r\n", e.Name, DateTime.Now, e.From,e.Content)); }
private string GetSayPath(Say say) { string audioPath; SaySound saySound = SaySounds[say]; if (saySound.Have) { return saySound.GetRandom(); } else { //logica de remplazo para desarrollar caca } return ""; }
public virtual void SayMsg(Say how_say, ushort text_msg, uint str_num, string lexems) { Crit_SayMsgLex(thisptr, (byte)how_say, text_msg, str_num, lexems); }
public virtual void SayMsg(Say how_say, ushort text_msg, uint str_num) { Crit_SayMsg(thisptr, (byte)how_say, text_msg, str_num); }
public virtual void Say(Say how_say, string text, params object[] args) { Crit_Say(thisptr, (byte)how_say, string.Format(text, args)); }
public override string Arm(ServerBattle battle, Say e, string arguments = null) { mode = GetValidTypes().FirstOrDefault(x => x.Description().ToLower().Contains(arguments?.ToLower() ?? "")); return($"Change room to {mode.Description()}?"); }
public virtual void Say(Say how_say, string text, params object[] args) { var ss = new ScriptString(string.Format(text, args)); Crit_Say(thisptr, (byte)how_say, ss.ThisPtr); }
public override string Arm(ServerBattle battle, Say e, string arguments = null) { return("Do you want to enable cheats?"); }
public void Talk(Say say) { Voice.Talk(say); }
public void Twenty_two() { Assert.Equal("twenty-two", Say.InEnglish(22L)); }
public override async Task ExecuteArmed(ServerBattle battle, Say e) { await battle.SwitchMinLevel(lvl); await battle.SayBattle("Min level changed to " + lvl); }
public override async Task ExecuteArmed(ServerBattle battle, Say e) { await battle.RegisterVote(e, opt != 2); }
public override async Task ExecuteArmed(ServerBattle battle, Say e) { battle.StopVote(); await battle.SayBattle("poll cancelled"); }
public void EraseTextListener(Say say_type, string first_str, ushort parameter) { Global_EraseTextListener((int)say_type, new ScriptString(first_str).ThisPtr, parameter); }
public void RunCommandDirectly <T>(Say e, string args = null) where T : BattleCommand, new() { var t = new T(); t.Run(this, e, args); }
static void Main(string[] args) { Say.hello("example"); Console.WriteLine("Hello World!"); // The following API call is meant to demonstrate // vulnerable methods (the simplest case). var hashedPassword = BCrypt.Net.BCrypt.HashPassword("my-secret-password"); BCrypt.Net.BCrypt.Verify("wrong-password", hashedPassword); // The following API calls are meant to demonstrate update // advisor and auto pull request features. The following // is the detail of the libraries and the expected // results. // // The following are the cases where the update versions // are of the same frameworks as the currently-used // version. // +--------------------+--------------+----------------+--------------+-----------------+----------+ // | Dependency | Current | Current | Update | Update | Breaking | // | | Version | Framework(s) | Version | Framework(s) | Update | // +====================+==============+================+==============+=================+==========+ // | recurly-api-client | 1.8.0 | net35 | 1.11.4 | net35 | No | // +--------------------+--------------+----------------+--------------+-----------------+----------+ // | DotNetZip | 1.10.0 | net20 | 1.11.0 | net20 | Yes | // +--------------------+--------------+----------------+--------------+-----------------+----------+ // // The following are the cases where the update versions // have different frameworks than the current versions. // +--------------------+---------------+----------------------+--------------+--------------------+----------+ // | Dependency | Current | Current | Update | Update | Breaking | // | | Version | Framework(s) | Version | Framework(s) | Update | // +====================+===============+======================+==============+====================+==========+ // | SharpZipLib | 1.0.0-alpha1 | netstandard1.3 | 1.0.0-rc1 | net45, | Yes | // | | | | | netstandard2.0 | | // +--------------------+---------------+----------------------+--------------+--------------------+----------+ // | SharpCompress | 0.17.1 | net35, net45, | 0.21.0 | net35, net45, | Yes | // | | | netstandard1.0 | | netstandard1.0, | | // | | | | | netstandard2.0 | | // +--------------------+---------------+----------------------+--------------+--------------------+----------+ // | YamlDotNet | 3.7.0 | net35, | 3.8.0-pre138 | dotnet, net35, | No | // | | | portable-net45+... | | portable-net45+... | | // +--------------------+---------------+----------------------+--------------+--------------------+----------+ // Usage of recurly-api-client API // This does not cause a breaking update from 1.8.0 to // 1.11.4 (safe version). FilterCriteria criteria = FilterCriteria.Instance; if (criteria.BeginTime != null) { Console.WriteLine("Begin time: " + criteria.BeginTime); } // Usage of DotNetZip API // This is necesssary to prevent DotNetZip complaining // about IBM437 encoding. Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Console.WriteLine("Unzipping example ZIP file using DotNetZip"); // From https://dotnetfiddle.net/U1pPeD using (Ionic.Zip.ZipFile zip = Ionic.Zip.ZipFile.Read(@"resources" + Path.DirectorySeparatorChar + "example.zip")) { Console.WriteLine("Files found in zip:"); foreach (Ionic.Zip.ZipEntry e in zip) { Console.WriteLine(e.FileName); } } // Usage of SharpZipLib API // This API is vulnerable; see // https://github.com/icsharpcode/SharpZipLib/issues/232 Console.WriteLine("Unzipping example ZIP file using SharpZipLib"); new FastZip().ExtractZip(@"resources" + Path.DirectorySeparatorChar + "example.zip", @".", null); // Usage of SharpCompress API // This calls an API method that does not break update ZipArchive zipArchive = ZipArchive.Create(); // Usage of YamlDotNet API var yaml = new YamlStream(); }
public virtual void SayMsg(Say how_say, ushort text_msg, uint str_num, string lexems) { var ss = new ScriptString(lexems); Crit_SayMsgLex(thisptr, (byte)how_say, text_msg, str_num, ss.ThisPtr); }
public override string Arm(ServerBattle battle, Say e, string arguments = null) { return(string.Empty); }
static void Main(string[] args) { var message = new Say().Hello(); Console.WriteLine(message); }
public Task Respond(Say e, string text) { return(SayBattle(text, e?.User)); }
public async Task Setup(Func <string, string> eligibilitySelector, List <PollOption> options, Say creator, string Topic) { EligiblitySelector = eligibilitySelector; Options = options; Creator = creator; this.Topic = Topic; winCount = battle.Users.Values.Count(x => EligiblitySelector(x.Name) == null) / 2 + 1; if (winCount <= 0) { winCount = 1; } await battle.server.Broadcast(battle.Users.Keys, GetBattlePoll()); if (yesNoVote) { battle.SayGame(string.Format("Poll: {0} [!y={1}/{3}, !n={2}/{3}]", Topic, userVotes.Count(x => x.Value == 0), userVotes.Count(x => x.Value == 1), winCount)); } }
/// <summary> /// 增加一条数据 /// </summary> public void AddSay(Say entity) { linqHelper.InsertEntity <Say>(entity); }
public override void DrawCommandGUI() { serializedObject.Update(); bool showPortraits = false; CommandEditor.ObjectField <Character>(characterProp, new GUIContent("Character", "Character that is speaking"), new GUIContent("<None>"), Character.ActiveCharacters); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(" "); characterProp.objectReferenceValue = (Character)EditorGUILayout.ObjectField(characterProp.objectReferenceValue, typeof(Character), true); EditorGUILayout.EndHorizontal(); Say t = target as Say; // Only show portrait selection if... if (t._Character != null && // Character is selected t._Character.Portraits != null && // Character has a portraits field t._Character.Portraits.Count > 0) // Selected Character has at least 1 portrait { showPortraits = true; } if (showPortraits) { CommandEditor.ObjectField <Sprite>(portraitProp, new GUIContent("Portrait", "Portrait representing speaking character"), new GUIContent("<None>"), t._Character.Portraits); } else { if (!t.ExtendPrevious) { t.Portrait = null; } } EditorGUILayout.PropertyField(storyTextProp); EditorGUILayout.PropertyField(descriptionProp); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(extendPreviousProp); GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("Tag Help", "View available tags"), new GUIStyle(EditorStyles.miniButton))) { showTagHelp = !showTagHelp; } EditorGUILayout.EndHorizontal(); if (showTagHelp) { DrawTagHelpLabel(); } EditorGUILayout.Separator(); EditorGUILayout.PropertyField(voiceOverClipProp, new GUIContent("Voice Over Clip", "Voice over audio to play when the text is displayed")); EditorGUILayout.PropertyField(showAlwaysProp); if (showAlwaysProp.boolValue == false) { EditorGUILayout.PropertyField(showCountProp); } GUIStyle centeredLabel = new GUIStyle(EditorStyles.label); centeredLabel.alignment = TextAnchor.MiddleCenter; GUIStyle leftButton = new GUIStyle(EditorStyles.miniButtonLeft); leftButton.fontSize = 10; leftButton.font = EditorStyles.toolbarButton.font; GUIStyle rightButton = new GUIStyle(EditorStyles.miniButtonRight); rightButton.fontSize = 10; rightButton.font = EditorStyles.toolbarButton.font; EditorGUILayout.PropertyField(fadeWhenDoneProp); EditorGUILayout.PropertyField(waitForClickProp); EditorGUILayout.PropertyField(stopVoiceoverProp); EditorGUILayout.PropertyField(setSayDialogProp); EditorGUILayout.PropertyField(waitForVOProp); if (showPortraits && t.Portrait != null) { Texture2D characterTexture = t.Portrait.texture; float aspect = (float)characterTexture.width / (float)characterTexture.height; Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true)); if (characterTexture != null) { GUI.DrawTexture(previewRect, characterTexture, ScaleMode.ScaleToFit, true, aspect); } } serializedObject.ApplyModifiedProperties(); }
public override async Task ExecuteArmed(ServerBattle battle, Say e) { await battle.RunServerBalance(false, teamCount, null); await battle.SayBattle("Teams were balanced"); }
public override string Arm(ServerBattle battle, Say e, string arguments = null) => String.Empty;
public virtual async Task OnSaid(Say say) { Said(this, say); }
public override async Task ExecuteArmed(ServerBattle battle, Say e) { await InternalCommand.ExecuteArmed(battle, e); }
public override async Task ExecuteArmed(ServerBattle battle, Say e) { await battle.SwitchGameType(mode); await battle.SayBattle("Game type changed to " + mode.Description()); }
/// <summary> /// Prepares the command /// </summary> /// <param name="battle"></param> /// <param name="e"></param> /// <param name="arguments"></param> /// <returns>poll question, null to abort command</returns> public abstract string Arm(ServerBattle battle, Say e, string arguments = null);
public void One() { Assert.Equal("one", Say.InEnglish(1L)); }
/// <summary> /// Execute previously armed command, state stored in class /// </summary> /// <param name="battle"></param> /// <param name="e"></param> public abstract Task ExecuteArmed(ServerBattle battle, Say e = null);
public void Twenty() { Assert.Equal("twenty", Say.InEnglish(20L)); }
public void Hello_Name_ReturnsThere() { string sentence = Say.Hello("Name"); Assert.AreEqual("Hello, Name!", sentence); }
public void One_hundred() { Assert.Equal("one hundred", Say.InEnglish(100L)); }
public void Hello_Null_ReturnsThere() { string sentence = Say.Hello(null); Assert.AreEqual("Hello, there!", sentence); }