public ImmutableVariableStorage GetTaint() { var superglobals = new List<Variable> { new Variable("_GET", VariableScope.SuperGlobal), new Variable("_POST", VariableScope.SuperGlobal), new Variable("_REQUEST", VariableScope.SuperGlobal), new Variable("_COOKIE", VariableScope.SuperGlobal), DefaultServerVariable() }; var globals = new List<Variable> { new Variable("HTTP_GET_VARS", VariableScope.File), new Variable("HTTP_POST_VARS", VariableScope.File), new Variable("HTTP_SERVER_VARS", VariableScope.File), new Variable("HTTP_COOKIE_VARS", VariableScope.File), }; Action<Variable> setDefaultTaint = x => { x.Info.NestedVariableDefaultTaintFactory = _taintedTaintFactory; x.Info.DefaultDimensionTaintFactory = _taintedTaintFactory; x.Info.NestedVariablePossibleStoredDefaultTaintFactory = _untaintedTaintFactory; }; globals.ForEach(setDefaultTaint); superglobals.ForEach(setDefaultTaint); superglobals.AddRange(new[] { new Variable("GLOBALS", VariableScope.SuperGlobal), new Variable("_FILES", VariableScope.SuperGlobal), new Variable("_SESSION", VariableScope.SuperGlobal), new Variable("_ENV", VariableScope.SuperGlobal), }); var rawPost = new Variable("HTTP_RAW_POST_DATA", VariableScope.File) { Info = { Taints = _taintedTaintFactory() } }; var argv = new Variable("argv", VariableScope.File); // Docs: "The first argument $argv[0] is always the name that was used to run the script." - goo.gl/hrek2V argv.Info.Variables.Add(new VariableTreeDimension() { Index = 0, Key = "0" }, new Variable("0", VariableScope.Instance)); globals.AddRange(new[] {rawPost, argv}); var varStorage = new VariableStorage(); varStorage.SuperGlobals.AddRange(superglobals.ToDictionary(s => s.Name, s => s)); varStorage.GlobalVariables.AddRange(globals.ToDictionary(g => g.Name, g => g)); return ImmutableVariableStorage.CreateFromMutable(varStorage); }
public Dialogue(Yarn.VariableStorage continuity) { this.continuity = continuity; loader = new Loader (this); library = new Library (); library.ImportLibrary (new StandardLibrary ()); // Register the "visited" function, which returns true if we've visited // a node previously (nodes are marked as visited when we leave them) library.RegisterFunction ("visited", 1, delegate(Yarn.Value[] parameters) { var name = parameters[0].AsString; return visitedNodeNames.Contains(name); }); }
private void textToReverse_click(object sender, RoutedEventArgs e) { textToReverse_text.Text = VariableStorage.Pick().VariableName; }
private void truncate_number_click(object sender, RoutedEventArgs e) { working_variable = VariableStorage.Pick(); if (working_variable != null) numberToTruncate_text.Text = working_variable.VariableName; }
IEnumerator Start() { // Find variable storage and get levelId variableStorageObject = GameObject.FindGameObjectWithTag("Storage"); if (variableStorageObject == null) { Debug.Log("Can't find variable storage object! Redirecting back to main menu..."); SceneManager.LoadScene(0); } else { gameObject.GetComponent <InGameSettingToggles> ().initiateStorage(variableStorageObject); variableStorageScript = variableStorageObject.GetComponent <VariableStorage> (); levelId = variableStorageScript.levelId; overlayMessageObject.GetComponent <Text> ().text = variableStorageScript.message; variableStorageScript.message = ""; // Play music if (variableStorageObject.GetComponent <AudioSource> ().clip != (levelId == 0 ? variableStorageScript.infiniteMusic : variableStorageScript.levelsMusic)) { variableStorageObject.GetComponent <AudioSource> ().clip = levelId == 0 ? variableStorageScript.infiniteMusic : variableStorageScript.levelsMusic; } toggleMusic(gameObject.GetComponent <InGameSettingToggles> ().music); // Find ball gameobject ball = GameObject.FindGameObjectWithTag("Player"); // Determine the operating gamemode and run appropriate generation if (levelId == 0) { // Start generating modules gameObject.GetComponent <InfiniteGeneration> ().enabled = true; // Enable camera tracking and pass ball reference gameObject.GetComponent <FollowBall> ().enabled = true; gameObject.GetComponent <FollowBall> ().ball = ball; overlayNumberObject.SetActive(false); overlayImageObject.SetActive(true); gameObject.GetComponent <Collider2D> ().offset = new Vector2(0, -0.5f); topPanel.SetActive(true); } else { // Start generating level gameObject.GetComponent <LevelsGeneration> ().enabled = true; int[] returnData = gameObject.GetComponent <LevelsGeneration> ().generateLevel(levelId - 1); coinAmount = returnData [0]; ball.transform.position = new Vector3(returnData[1], 2, 1); overlayNumberObject.GetComponent <Text> ().text = levelId.ToString(); } loadData(); // Initialise score score = 0; UpdateScore(); Physics2D.gravity = new Vector2(0, -9.81f); // Freeze ball and wait to enable momentum check ball.GetComponent <Rigidbody2D> ().constraints = RigidbodyConstraints2D.FreezeAll; yield return(new WaitForSeconds(timeToLerp)); lerpEnabled = true; ball.GetComponent <Rigidbody2D> ().constraints = RigidbodyConstraints2D.None; yield return(new WaitForSeconds(timeToFirstCheck)); ball.GetComponent <MomentumCheck> ().enabled = true; } }
public void CheckQuest() { if (quest != null && quest.activeQuest == true) { //Checks to see if that quest goal is active if (quest.goalOneActive == true && quest != null) { //Searches for the quest goal one item in the player inventory if (inventoryItemList.itemList.Contains(quest.goalOne.questItem)) { //sets the goal to achieved quest.goalOne.goalAchieved = true; //Increases the number of completed goals quest.goalsCompleted += 1; //Logs that the goal is complete Debug.Log("Goal One Complete"); } } if (quest.goalTwoActive == true && quest != null) { if (inventoryItemList.itemList.Contains(quest.goalTwo.questItem)) { quest.goalTwo.goalAchieved = true; quest.goalsCompleted += 1; Debug.Log("Goal Two Complete"); } } if (quest.goalThreeActive == true && quest != null) { if (inventoryItemList.itemList.Contains(quest.goalThree.questItem)) { quest.goalThree.goalAchieved = true; quest.goalsCompleted += 1; Debug.Log("Goal Three Complete"); } } if (quest.goalFourActive == true && quest != null) { if (inventoryItemList.itemList.Contains(quest.goalFour.questItem)) { quest.goalFour.goalAchieved = true; quest.goalsCompleted += 1; Debug.Log("Goal Four Complete"); } } if (quest.goalFiveActive == true && quest != null) { if (inventoryItemList.itemList.Contains(quest.goalFive.questItem)) { quest.goalFive.goalAchieved = true; quest.goalsCompleted += 1; Debug.Log("Goal Five Complete"); } } } // Can this bit be written with a function? Something like this? /// public void removeGoalItem(Quest) /// { /// inventoryItemList.itemList.Remove(questItem); /// goalActive = false; /// } /// /// To run then use: /// if (quest.goalOneActive == true) /// { /// removeGoalItem(quest.goalOne); /// } if (quest != null && quest.numberOfGoals <= quest.goalsCompleted) { //Set quest as complete quest.giveRewardItem = true; Debug.Log("Reward Given"); //Deletes the items from the players Inventory if (quest.goalOneActive == true) { inventoryItemList.itemList.Remove(quest.goalOne.questItem); //Inactivates the goal quest.goalOne.goalActive = false; } if (quest.goalTwoActive == true) { inventoryItemList.itemList.Remove(quest.goalTwo.questItem); quest.goalTwo.goalActive = false; } if (quest.goalThreeActive == true) { inventoryItemList.itemList.Remove(quest.goalThree.questItem); quest.goalThree.goalActive = false; } if (quest.goalFourActive == true) { inventoryItemList.itemList.Remove(quest.goalFour.questItem); quest.goalFour.goalActive = false; } if (quest.goalFiveActive == true) { inventoryItemList.itemList.Remove(quest.goalFive.questItem); quest.goalFive.goalActive = false; } } //If the quest is complete if (quest != null && quest.giveRewardItem == true) { //Give item one to player inventory inventoryItemList.itemList.Add(quest.rewardItem); quest.giveRewardItem = false; quest.activeQuest = false; quest.goalsCompleted = 0; Debug.Log("Quest Complete"); //Sets the quest complete variable within Yarn and progresses the conversation VariableStorage varStore = dialogueRunner.GetComponent <VariableStorage>(); var questSet = new Yarn.Value(true); varStore.SetValue("$quest_complete", questSet); } }
public int Execute() { try { sqlResultVarName = VariableStorage.VariableNameFormator(sqlResultVarName); if (GetConnSchemaIndex == 0) { OleDbConnection OledbConnection = new OleDbConnection(newConnStr); if (OledbConnection.State.ToString() != "Open") { OledbConnection.Open(); } OleDbCommand command = new OleDbCommand(Query, OledbConnection); OleDbDataAdapter adp = new OleDbDataAdapter(command); DataSet dataSet = new DataSet(); adp.Fill(dataSet); dataSet.WriteXml(@"E:\queryresult.xml"); if (VariableStorage.DataBaseQueryResultlVar.ContainsKey(sqlResultVarName)) { VariableStorage.DataBaseQueryResultlVar.Remove(sqlResultVarName); } VariableStorage.DataBaseQueryResultlVar.Add(sqlResultVarName, Tuple.Create(this.ID, dataSet)); } else if (GetConnSchemaIndex == 1) { OleDbConnection OledbConnection = VariableStorage.DataBaseConnStrVar[connStrVar].Item2; if (OledbConnection.State.ToString() != "Open") { OledbConnection.Open(); } OleDbCommand command = new OleDbCommand(Query, OledbConnection); OleDbDataAdapter adp = new OleDbDataAdapter(command); DataSet dataSet = new DataSet(); adp.Fill(dataSet); dataSet.WriteXml(@"E:\queryresult.xml"); if (VariableStorage.DataBaseQueryResultlVar.ContainsKey(sqlResultVarName)) { VariableStorage.DataBaseQueryResultlVar.Remove(sqlResultVarName); } VariableStorage.DataBaseQueryResultlVar.Add(sqlResultVarName, Tuple.Create(this.ID, dataSet)); } return(1); } catch (Exception ex) { return(0); } }
private void Start() { nPC = GetComponent <NPC>(); variables = FindObjectOfType <VariableStorage>(); currentDuelCondition = duelConditions[0]; }
private void VariablePicker_loaded(object sender, RoutedEventArgs e) { variableGrid.ItemsSource = VariableStorage.GetAllVariables(); }
private void text_to_convert_pick(object sender, RoutedEventArgs e) { textToConvert_text.Text = VariableStorage.Pick().VariableName; }
private void text_to_find_click(object sender, RoutedEventArgs e) { textToFind_text.Text = VariableStorage.Pick().VariableName; }
private void variable_picker_Click(object sender, RoutedEventArgs e) { textToParse_text.Text = VariableStorage.Pick().VariableName; }
private void ok_button_Click(object sender, RoutedEventArgs e) { GetSubTextData.StartIndexComboIndex = startIndex_combo.SelectedIndex; GetSubTextData.LengthComboIndex = length_combo.SelectedIndex; if (working_variable != null) { GetSubTextData.OriginalText = working_variable.ObjectValue.ToString(); } else { GetSubTextData.OriginalText = originalText_text.Text.Trim(); } int integer; if (startIndex_combo.SelectedIndex == 1) { if (startPosition_variable != null) { GetSubTextData.StartIndex = Convert.ToInt32(startPosition_variable.ObjectValue); } else { GetSubTextData.StartIndex = Convert.ToInt32(startPositon_text.Text.Trim()); } } else { GetSubTextData.StartIndex = 0; } if (length_combo.SelectedIndex == 1) { if (numberOfChar_variable != null) { GetSubTextData.Length = Convert.ToInt32(numberOfChar_variable.ObjectValue); } else { GetSubTextData.Length = Convert.ToInt32(numberOfChar_text.Text.Trim()); } } else { GetSubTextData.Length = originalText_text.Text.Trim().Length; } GetSubTextData.SubTextStorVar = VariableStorage.VariableNameFormator(subtextStoreVar_text.Text.Trim()); if (!string.IsNullOrEmpty(subtextStoreVar_text.Text.Trim())) { if (VariableStorage.SubTextVar.ContainsKey(GetSubTextData.SubTextStorVar)) { VariableStorage.SubTextVar.Remove(GetSubTextData.SubTextStorVar); } VariableStorage.SubTextVar.Add(GetSubTextData.SubTextStorVar, Tuple.Create(GetSubTextData.ID, "value has not been set yet")); } ((((this.Parent as StackPanel).Parent as Grid).Parent as TaskViewFrameUC).Parent as MetroWindow).DialogResult = false; }
private void AssertThatVariableEstablished(string name, string value, VariableStorage storage) { storage.Add(name, value); Assert.That(storage.Get(name), Is.EqualTo(value)); }
private void textToTrim_click(object sender, RoutedEventArgs e) { working_variable = VariableStorage.Pick(); textToTrim_text.Text = working_variable.VariableName; }