public static void RegisterRequiredInteractionKind(int dataContextHashCode, InteractionKind requestedButtonType) { buttonTypeRequestCache.AddOrUpdate(dataContextHashCode, requestedButtonType, (i,ik) => requestedButtonType); }
public UserSelectInteraction(InteractionKind kind, TwitterStatusBase status, Action<IEnumerable<AccountElement>> callback) { this.Kind = kind; this.Status = status; this.Callback = callback; }
public ActivateInteractionMsg(Type interactionViewModelType, InteractionKind interactionKind) : base(interactionViewModelType) { _interactionKind = interactionKind; }
/// <summary> /// Parses function strings according to the function grammar. /// At the moment, these include Trigger functions and OnComplete functions. /// /// </summary> /// <returns>The parsed result.</returns> /// <param name="s">Function string to be parsed</param> internal static ParsingResult ParseString(string s) { // Better documentation is in a text file // EXAMPLES OF LANGUAGE // target WITH source ex: Cut Tree With Axe // source ON target ex: Drop Water On ActiveFire // ENTER location ex: Enter Winter // the source object is the tool // this is also object 1 // the target object is the interacted object // this is object 2 // types of actions: Get, Enter, Drop, Cut, Hit, Dig, Merge, Open, None // Declares variables: string[] toParse = s.Split(' '); int length = toParse.Length; string obj1 = String.Empty; // tool or source string obj2 = String.Empty; int tempQuantity = 1; int obj1Quantity = 0; int obj2Quantity = 0; int amountOfTime = 0; string location = String.Empty; string objToObjIntrcType = String.Empty; InteractionKind action = InteractionKind.None; UIActionKind uiEventKind = UIActionKind.None; ParsingResult parsingResult = new ParsingResult(); // Goes through string word by word for (int i = 0; i < length; i++) { if (toParse[i].Equals("Player") || toParse[i].Equals("Object")) // ignores these for now { } else if (toParse[i].Equals("Item") && i + 1 < length) { i++; // next expected word might be a quantity if (Int32.TryParse(toParse[i], out tempQuantity)) { i++; } // if next expected word is an item, get the item if (!String.IsNullOrEmpty(objToObjIntrcType)) { // figure out which item is being referred to if (objToObjIntrcType.Equals("With") || objToObjIntrcType.Equals("Become")) { obj2 = obj1; // target item obj2Quantity = obj1Quantity; obj1 = toParse[i]; // source item = this current item obj1Quantity = tempQuantity; } else if (objToObjIntrcType.Equals("On") || objToObjIntrcType.Equals("And")) { obj2 = toParse[i]; // target item = this current item obj2Quantity = tempQuantity; } } else if (action == InteractionKind.Become) { //i++; // in the case of an OnComplete being parsed: obj2 = toParse[i]; obj2Quantity = tempQuantity; } else { // if this is the first reference to an item: obj1 = toParse[i]; obj1Quantity = tempQuantity; } } else if (toParse[i] == "TargetItem") { obj1 = toParse[i]; } else if (toParse[i].Equals("With") || toParse[i].Equals("On") || toParse[i].Equals("And")) { objToObjIntrcType = toParse[i]; //if objects interact, set the interaction type } else if (toParse[i].Equals("For") && action == InteractionKind.Leave) { //Trigger = "Player Leave Item ItemName For 2 Seasons" Int32.TryParse(toParse[++i], out amountOfTime); i++; } else if (toParse[i].Equals("Location") && i + 1 < length) { i++; location = toParse[i]; } else if (Enum.TryParse <InteractionKind>(toParse[i], out action)) { if (action == InteractionKind.Play) { Enum.TryParse <UIActionKind>(toParse[++i], out uiEventKind); obj1 = toParse[++i]; } } } parsingResult.interactionKind = action; parsingResult.uiEventKind = uiEventKind; parsingResult.obj1 = obj1; // tool parsingResult.obj2 = obj2; // other parsingResult.obj1Quantity = obj1Quantity; parsingResult.obj2Quantity = obj2Quantity; parsingResult.amountOfTime = amountOfTime; parsingResult.location = location; parsingResult.objToObjInteractionType = objToObjIntrcType; return(parsingResult); }
public ShowTextToUserMsg(string message, InteractionKind interactionKind) : base(typeof(MessageToUserViewModel), interactionKind) { Message = message; }