public RTChoice() { _title = "Choice"; _titleColor = Color.DimGray; _titleFont = new Font(FontFamily.GenericSansSerif, 8); _valueFont = new Font(FontFamily.GenericSansSerif, 8); _xdim = 50; _selectedItem = -1; _frontColor = Color.DimGray; frontPen = new Pen(_frontColor); frontBrush = new SolidBrush(_frontColor); _backColor = Color.Black; backBrush = new SolidBrush(_backColor); _entries = new List <RTDrawable>(); _offString = "off"; _numericMin = 0; _numericMax = 100; _choiceType = ChoiceType.ListDefined; //_entries.Add(new RTDrawableText("bla")); //_entries.Add(new RTDrawableWaveform(RTDrawableWaveform.WaveForm.Sine, -0.5)); //_entries.Add(new RTDrawableWaveform(RTDrawableWaveform.WaveForm.Triangle, -0.5)); //_entries.Add(new RTDrawableWaveform(RTDrawableWaveform.WaveForm.Saw, -0.5)); //_entries.Add(new RTDrawableWaveform(RTDrawableWaveform.WaveForm.Rectangle, -0.5)); //_entries.Add(new RTDrawableWaveform(RTDrawableWaveform.WaveForm.Noise, 0)); // _selectedItem = 0; // this.DoubleBuffered = true; }
// Constructors public DialogueText(int _id, int _nextTextID, string _exitValue, string _funcValueShowParts, List <Choice> _choiceList, List <TextPart> _textParts) { // Copy m_textID = _id; m_exitValue = _exitValue; m_funcValuShowParts = _funcValueShowParts; m_nextTextID = _nextTextID; m_textParts = _textParts; // Add choices to list if (_choiceList != null) { foreach (Choice c in _choiceList) { m_choiceList.Add(c.ChoiceID, c); } } // Set type if (m_exitValue == null || m_exitValue.Length == 0 && m_nextTextID < 0) { m_autoChoiceType = ChoiceType.CHOICE_NONE; } else if (m_exitValue == null || m_exitValue.Length == 0) { m_autoChoiceType = ChoiceType.CHOICE_NEXT_TEXT; } else { m_autoChoiceType = ChoiceType.CHOICE_EXIT; } }
public void TestConstructor_SetsId() { const ChoiceType id = ChoiceType.Gce; var objectUnderTest = new GoogleCloudExtension.PublishDialog.Steps.Choice.Choice(id, null, null, null, null); Assert.AreEqual(id, objectUnderTest.Id); }
/** * I don't even know what this does, I'll remove the type options unless I need them */ public static void Choice(string text, ChoiceType type, int min = 0, int max = 0) { System.Console.WriteLine(text); switch (type) { case ChoiceType.Boolean: string response; bool did = false; do { response = Prompt("[y/n]", true); if (response.ToLower().Contains("y")) { did = true; } } while (response.Equals("")); Display(did ? "\nYou did it!" : "\nYou didn't do it."); break; case ChoiceType.NumberRange: System.Console.Write("(" + min + "-" + max + ") >"); break; case ChoiceType.String: System.Console.Write("(string) > "); break; default: System.Console.WriteLine("Error: parameter 'type' does not match recognizable 'ChoiceType'"); break; } }
public void ShowWindow(InteractiveObject _npc, bool sleepNearEnemy, bool outOfPills, bool trade, bool repel) { tradeArrows.SetActive(false); if (sleepNearEnemy && !outOfPills) { choice = ChoiceType.sleep; npc = null; title.text = "Monsters around."; description.text = "Monsters will scare you and damage your toy while you're sleeping. Fall asleep?"; } else if (!sleepNearEnemy && outOfPills) { choice = ChoiceType.sleep; npc = null; title.text = "No pills."; description.text = "The next night will be much worse. Fall asleep?"; } else if (sleepNearEnemy && outOfPills) { choice = ChoiceType.sleep; npc = null; title.text = "Monsters and no pills"; description.text = "You're going to bed with the monsters around. And you run out of pills. This is madness. Fall asleep?"; } _anim.SetTrigger("Active"); }
public Choice(ChoiceType id, string name, string toolTip, ImageSource icon, ICommand command) { Id = id; Name = name; ToolTip = toolTip; Icon = icon; Command = command; }
public VideosFilterChoice(string label, int id, List <VideoFilterOption> options, ChoiceType uiType, FilterType valueType) { this.label = label; this.Id = id; this.Options = options; this.uiType = uiType; this.ValueType = valueType; this.SetupFilters(); }
public ChoiceData(VideoFilterOption defaultChoice, List <VideoFilterOption> choices, VideoFilterOption choice, string label, int id, ChoiceType uiType) { this.ChoiceDefault = defaultChoice; this.Choices = choices; this.ChoiceMade = choice; this.UILabel = label; this.Id = id; this.UIType = uiType; }
/// <summary> /// contructor /// </summary> /// <param name="text">the text to be displayed by this choice</param> public MenuChoice(string text) { this.text = text; m_nodes = new MenuChoiceCollection(); m_choiceType = ChoiceType.Normal; visibleOnSelectionOnly = true; textColor = Color.White; selectColor = Color.Green; }
internal Choice(T2 choice2Of2) { if (choice2Of2 == null) { throw new ArgumentNullException("choice2Of2"); } _choice2Of2 = choice2Of2; _choice1Of2 = default(T1); _tag = ChoiceType.Choice2Of2; }
public Choice() { selectText = new List <TextAndPosition>(); onlyShowText = new List <TextAndPosition>(); streamText = new List <TextAndPosition>(); indicateChoice = new Dictionary <int, Object>(); monsterList = new List <Enemy>(); //npcList = new List<NPC>(); choiceType = ChoiceType.NORMAL; }
internal void Out(Alternative alternative) { lock (modifying) { if (choiceType == ChoiceType.Input) { throw new JibuException("An ChannelReader is already using the Channel in another Choice"); } choiceType = ChoiceType.Output; alternativeForPassingToChoice = alternative; } }
private void setMode(TeamColour colour, ChoiceType choiceType) { pickColour = colour; pickType = choiceType; Color4 setColour(bool active) => active ? Color4.White : Color4.Gray; buttonRedBan.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Ban); buttonBlueBan.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Ban); buttonRedPick.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Pick); buttonBluePick.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Pick); }
/// Creates a Channel. internal UnbufferedChannel() { poisoned = false; modifying = new object(); writerLock = new object(); readerLock = new object(); dataPending = readerPending = false; choiceType = ChoiceType.None; choiceQueue = new Queue <Choice>(); reserved = false; channelReader = new ChannelReader <T>(this); channelWriter = new ChannelWriter <T>(this); }
private Choice(String text, Card cardSource, CardCollection cardTriggers, ChoiceType choiceType, Player playerSource, EventArgs eventArgs, Boolean isOrdered, Boolean isSpecific, int minimum, int maximum) { _Text = text; _CardSource = cardSource; _CardTriggers = cardTriggers; _ChoiceType = choiceType; _PlayerSource = playerSource; _EventArgs = eventArgs; _IsOrdered = isOrdered; _IsSpecific = isSpecific; _Minimum = minimum < 0 ? 0 : minimum; _Maximum = maximum < _Minimum ? _Minimum : maximum; }
/// <summary> /// Initializes an instance of the SendChoicesNode class. /// </summary> /// <param name="xmlNode">The XML Node describing the Node.</param> /// <param name="game">The game object related to the Node.</param> public SendChoicesNode(XmlNode xmlNode, Game game) { // entity % entity; #REQUIRED // type NMTOKEN #REQUIRED // ts NMTOKEN #IMPLIED _game = game; Int32.TryParse(xmlNode.Attributes?["entity"]?.Value, out Entity); if (xmlNode.Attributes?["type"]?.Value == null) { throw new NullReferenceException(); } Type = (ChoiceType)Enum.Parse(typeof(ChoiceType), xmlNode.Attributes?["type"]?.Value); Ts = xmlNode.Attributes?["ts"]?.Value; foreach (XmlNode childNode in xmlNode.ChildNodes) { Children.Add(NodeImporter.Import(childNode, game)); } }
public static ChooseTask CreatePlayerTaskChoice(Game game, int PlayerId, ChoiceType choiceType, List <int> entities) { switch (choiceType) { case ChoiceType.MULLIGAN: return(ChooseTask.Mulligan(game.Player1.PlayerId == PlayerId ? game.Player1 : game.Player2.PlayerId == PlayerId ? game.Player2 : null, entities)); case ChoiceType.GENERAL: return(ChooseTask.Pick(game.CurrentPlayer, entities[0])); default: return(null); } }
private PlayerTask ProcessPowerChoiceData(int PlayerId, ChoiceType choiceType, List <int> entities) { switch (choiceType) { case ChoiceType.MULLIGAN: return(ChooseTask.Mulligan(_game.Player1.PlayerId == PlayerId ? _game.Player1 : _game.Player2.PlayerId == PlayerId ? _game.Player2 : null, entities)); case ChoiceType.GENERAL: return(ChooseTask.Pick(_game.CurrentPlayer, entities[0])); default: return(null); } }
public void AddCards(IEnumerable <Card> cards) { switch (this.ChoiceType) { case DominionBase.ChoiceType.Cards: case DominionBase.ChoiceType.SuppliesAndCards: _Cards = _Cards.Concat(cards); break; case DominionBase.ChoiceType.Supplies: _Cards = cards; _ChoiceType = DominionBase.ChoiceType.SuppliesAndCards; break; default: throw new UnauthorizedAccessException("Cannot add cards to Choice Type!"); } }
public void JsonToObject(String jsonString) { Json json = new Json(); json.JsonString = jsonString; this.Name = json.GetItem("Name"); this.QuickDelegate = json.GetItem("QuickDelegate"); this.IsSavePoint = bool.Parse(json.GetItem("IsSavePoint")); this.IsVisit = bool.Parse(json.GetItem("IsVisit")); this.IsShowStateWindow = bool.Parse(json.GetItem("IsShowStateWindow")); this.BackgroundTextName = json.GetItem("BackgroundTextName"); this.selectText = json.GetJsonAbleList <TextAndPosition>("selectText"); this.onlyShowText = json.GetJsonAbleList <TextAndPosition>("onlyShowText"); this.streamText = json.GetJsonAbleList <TextAndPosition>("streamText"); this.returnText = json.GetJsonAbleList <TextAndPosition>("returnText"); this.indicateChoice = json.GetDictionary("indicateChoice"); this.monsterList = json.GetJsonAbleList <Enemy>("monsterList"); this.choiceType = Parse.ParseEnum <ChoiceType>(json.GetItem("choiceType")); }
// Constructor public Choice(int _id, string _text, string _funcValueNextTextID, string _exitValue, string _funcValueEnabled, List <DynamicScriptRef> _scriptRefs) { // Copy m_choiceID = _id; m_text = _text; m_exitValue = _exitValue; m_funcValueEnabled = _funcValueEnabled; m_funcValueNextTextID = _funcValueNextTextID; m_scriptReferences = _scriptRefs; // Set type if (m_exitValue == null || m_exitValue.Length == 0) { m_choiceType = ChoiceType.CHOICE_NEXT_TEXT; } else { m_choiceType = ChoiceType.CHOICE_EXIT; } }
private bool HasChoiceBeenMade(ChoiceType type) { switch (type) { case ChoiceType.Action: return(ChoiceMade != Action.None); case ChoiceType.Target: return(ChoiceTarget != 0); case ChoiceType.Card: return(CardToLose != null); case ChoiceType.Block: //check if ANYONE has blocked, so first person to block is the one that has to deal with it return(Players.Any(x => x.CallBluff == true || x.Block == true) || Players.Where(x => x.Cards.Count() > 0).All(x => x.CallBluff == false && x.Block == false)); default: return(true); } }
public override void ChildDeserialize(GenericReader reader) { /*int version = */ reader.ReadEncodedInt(); EnterBridge = reader.ReadBool(); EnterGreenZone = reader.ReadBool(); EnterYellowZone = reader.ReadBool(); EnterBlueZone = reader.ReadBool(); EnterRedZone = reader.ReadBool(); EnterTreasureZone = reader.ReadBool(); KilledRonins = reader.ReadInt(); KilledSouls = reader.ReadInt(); Opponent = (OpponentType)reader.ReadInt(); SendRoninKarma = reader.ReadBool(); SendSoulsKarma = reader.ReadBool(); Choice = (ChoiceType)reader.ReadInt(); }
protected Choice(Choice that) : this() { if (that.SelectText != null) { this.SelectText = that.SelectText.ConvertAll(new Converter <TextAndPosition, TextAndPosition>(o => (TextAndPosition)o.Clone())); } if (that.OnlyShowText != null) { this.OnlyShowText = that.OnlyShowText.ConvertAll(new Converter <TextAndPosition, TextAndPosition>(o => (TextAndPosition)o.Clone())); } if (that.StreamText != null) { this.StreamText = that.StreamText.ConvertAll(new Converter <TextAndPosition, TextAndPosition>(o => (TextAndPosition)o.Clone())); } if (that.ReturnText != null) { this.ReturnText = that.ReturnText.ConvertAll(new Converter <TextAndPosition, TextAndPosition>(o => (TextAndPosition)o.Clone())); } this.IndicateChoice = new Dictionary <int, Object>(that.IndicateChoice); this.QuickDelegate = that.QuickDelegate; this.Name = that.Name; this.ChoiceType = that.ChoiceType; this.IsSavePoint = that.IsSavePoint; this.IsShowStateWindow = that.IsShowStateWindow; this.BackgroundTextName = that.BackgroundTextName; if (!IsEmptyList(that.EnemyList)) { if (that.EnemyList[0] != null) { this.EnemyList = that.EnemyList.ConvertAll(new Converter <Enemy, Enemy>(o => (Enemy)o.Clone())); } } // if(that.NPCList != null) // this.NPCList = that.NPCList.ConvertAll(new Converter<NPC, NPC>(o => (NPC)o.Clone())); }
public void AddCard(Card card) { switch (this.ChoiceType) { case DominionBase.ChoiceType.Cards: case DominionBase.ChoiceType.SuppliesAndCards: _Cards = _Cards.Concat(new CardCollection { card }); break; case DominionBase.ChoiceType.Supplies: _Cards = _Cards.Concat(new CardCollection { card }); _ChoiceType = DominionBase.ChoiceType.SuppliesAndCards; break; default: throw new UnauthorizedAccessException("Cannot add cards to Choice Type!"); } }
/// <summary> /// Sleeps until a choice has been made /// </summary> /// <param name="timeToChoose">Time in half seconds to choose</param> /// <returns>Whether or not a choice was actually made</returns> private Action WaitForChoice(ChoiceType type, int Id = 0, bool canBlock = false, bool canBluff = false, int timeToChoose = 60) { if (type == ChoiceType.Card) { CardToLose = null; } var allowed = 0; while (!HasChoiceBeenMade(type) && timeToChoose > 0) { Thread.Sleep(500); if (type == ChoiceType.Block) { var temp = Players.Count(x => x.Cards.Count() > 0 && x.Block == false && x.CallBluff == false) - 1; if (temp != allowed) { allowed = temp; //group or PM if (IsGroup) { var r = Bot.Edit(ChatId, LastMessageId, LastMessageSent, CreateBlockMenu(Id, canBlock, canBluff, allowed)).Result; LastMessageId = r.MessageId; } else { foreach (var p in Players.Where(x => x.Cards.Count() > 0 && x.Id != Id)) { var r = Bot.Edit(p.Id, p.LastMessageId, p.LastMessageSent, CreateBlockMenu(Id, canBlock, canBluff, allowed)).Result; p.LastMessageId = r.MessageId; } } } } timeToChoose--; } return(ChoiceMade); }
internal BufferedChannel(JibuBuffer buffertype, int size) : base() { poisoned = false; modifying = new object(); writerLock = new object(); readerLock = new object(); readerPending = false; choiceType = ChoiceType.None; choiceQueue = new Queue <Choice>(); channelReader = new ChannelReader <T>(this); channelWriter = new ChannelWriter <T>(this); writerBlocked = false; blockedReaderLock = new object(); blockedWriterLock = new object(); readersBlocked = 0; writersBlocked = 0; this.size = size; reservedIds = new Dictionary <int, int>(); switch (buffertype) { case JibuBuffer.Fifo: buf = new FifoBuffer <T>(size); break; case JibuBuffer.Lifo: buf = new LifoBuffer <T>(size); break; case JibuBuffer.Infinite: buf = new InfiniteBuffer <T>(); this.size = int.MaxValue; break; } }
public override void ChildDeserialize( GenericReader reader ) { /*int version = */ reader.ReadEncodedInt(); EnterBridge = reader.ReadBool(); EnterGreenZone = reader.ReadBool(); EnterYellowZone = reader.ReadBool(); EnterBlueZone = reader.ReadBool(); EnterRedZone = reader.ReadBool(); EnterTreasureZone = reader.ReadBool(); KilledRonins = reader.ReadInt(); KilledSouls = reader.ReadInt(); Opponent = (OpponentType) reader.ReadInt(); SendRoninKarma = reader.ReadBool(); SendSoulsKarma = reader.ReadBool(); Choice = (ChoiceType) reader.ReadInt(); }
/// <summary> /// sets the left right choices for this menu choice /// </summary> /// <param name="choice">string value of the choice</param> public void AddLeftRightChoices(Array choices) { m_choiceType = ChoiceType.LeftRight; m_selectedChoice = 0; foreach (string str in choices) { MenuChoice c = m_nodes.AddChoice(str); c.selectColor = selectColor; c.textColor = textColor; } }
private void setMode(TeamColour colour, ChoiceType choiceType) { pickColour = colour; pickType = choiceType;
private ChoiceResult(ChoiceType choiceType) { _ChoiceType = choiceType; }
/// <summary> /// Initializes a new instance of the <see cref="ChoiceMetadataSettings" /> class. /// </summary> /// <param name="choices">choices.</param> /// <param name="value">value.</param> /// <param name="choiceType">choiceType.</param> public ChoiceMetadataSettings(List <string> choices = default(List <string>), List <string> value = default(List <string>), ChoiceType choiceType = default(ChoiceType)) { this.Choices = choices; this.Value = value; this.Choices = choices; this.Value = value; this.ChoiceType = choiceType; }
public FhirElementAttribute(string name, ChoiceType choice, XmlRepresentation representation) { Name = name; Choice = choice; XmlSerialization = representation; }
public void AddCards(IEnumerable<Card> cards) { switch (this.ChoiceType) { case DominionBase.ChoiceType.Cards: case DominionBase.ChoiceType.SuppliesAndCards: _Cards = _Cards.Concat(cards); break; case DominionBase.ChoiceType.Supplies: _Cards = cards; _ChoiceType = DominionBase.ChoiceType.SuppliesAndCards; break; default: throw new UnauthorizedAccessException("Cannot add cards to Choice Type!"); } }
internal Choice(ChoiceType type, T removed, T added) { Type = type; Removed = removed; Added = added; }