public bool Flag() { int flag = -2; //Task<DataSnapshot> callData = GetDataAsync(); FlagCheck check = new FlagCheck(GetDataAsync); Task <DataSnapshot> callData = check(); if (callData.IsCompleted) { if (callData.Result.ChildrenCount > 0) { flag = 1; print("flag = 1"); } else { flag = 0; print("flag = 0"); } } else { flag = -1; } Debug.Log("flag = " + flag); if (flag == 1) { return(true); } return(false); }
/// <summary> /// Helper function that parses the block of text that is the nextBlockList text. /// </summary> /// <param name="nextBlockListText"></param> /// <returns></returns> static List <NextBlock> ParseNextBlockList(string nextBlockListText) { //Create the list. List <NextBlock> nextBlockList = new List <NextBlock>(); //Split text string[] nextBlockData = (nextBlockListText.Trim()).Split(":"[0]); //If the nextBlockData length is less than 1, then it is empty. if (nextBlockData.Length > 1) { for (int i = 0; i < nextBlockData.Length; i++) { //Pull the whole entry in the nextblock list. Starts with [ ends with ]. List <string> thisBlockList = new List <string>(); thisBlockList.Add(nextBlockData[i]); do { i++; if (i > nextBlockData.Length) { throw new System.Exception("Error, somehow the csv didn't finish with a ']'. The line was: " + nextBlockData); } thisBlockList.Add(nextBlockData[i]); } while (!nextBlockData[i].Contains("]")); //Remove punctuation from the text. while loading them string block_key = Regex.Replace(thisBlockList[0], "[^\\w\\._]", ""); //Flag check list. List <FlagCheck> flagCheckList = new List <FlagCheck>(); //Loop over all the flags that need to be saved. FIrst part is just the block_key. for (int j = 1; j < thisBlockList.Count; j++) { FlagCheck fc = new FlagCheck(); fc.SetFlagKey(Regex.Replace(thisBlockList[j], "[^\\w\\._]", "")); string flag_val = Regex.Replace(thisBlockList[j + 1], "[^\\w\\._]", ""); j++; if (flag_val.Equals("True") || flag_val.Equals("true")) { fc.SetFlagVal(FlagCheck.flagvector_value.True); } else if (flag_val.Equals("False") || flag_val.Equals("false")) { fc.SetFlagVal(FlagCheck.flagvector_value.False); } flagCheckList.Add(fc); } //Put it into the data structure. NextBlock nb = new NextBlock(); nb.next_block = SceneBlockDictionary[block_key]; nb.flag_check_list = flagCheckList; nextBlockList.Add(nb); } } return(nextBlockList); }
public TTABResourceControl() { InitializeComponent(); LanguageCombo.Items.Clear(); LanguageCombo.Items.AddRange(STR.LanguageSetNames); InternalChange = true; LanguageCombo.SelectedIndex = 0; InternalChange = false; MotivePersonality.Items.Clear(); MotivePersonality.Items.AddRange(VaryNames); FlagNames = new Dictionary <CheckBox, string>(); if (Content.Content.Get().TS1) { FlagNames.Add(AllowVisitors, "AllowVisitors"); FlagNames.Add(AllowFriends, "TS1AllowAdults"); AllowFriends.Text = "Adult"; FlagNames.Add(AllowRoomies, "TS1AllowChild"); AllowRoomies.Text = "Child"; FlagNames.Add(AllowOwner, "TS1AllowDemoChild"); AllowOwner.Text = "Demo Child"; AllowCSRs.Hide(); AllowGhosts.Hide(); FlagNames.Add(AllowCats, "TS1AllowCats"); FlagNames.Add(AllowDogs, "TS1AllowDogs"); FlagNames.Add(FlagDebug, "Debug"); FlagLeapfrog.Hide(); FlagNames.Add(FlagMustRun, "Joinable"); FlagMustRun.Text = "Joinable"; FlagNames.Add(FlagAutoFirst, "AutoFirst"); FlagNames.Add(FlagRunImmediately, "RunImmediately"); FlagNames.Add(FlagConsecutive, "AllowConsecutive"); InteractionFlagsLabel.Hide(); FlagCarrying.Hide(); FlagRepair.Hide(); FlagCheck.Hide(); FlagDead.Hide(); } else { FlagNames.Add(AllowVisitors, "AllowVisitors"); FlagNames.Add(AllowFriends, "AllowFriends"); FlagNames.Add(AllowRoomies, "AllowRoommates"); FlagNames.Add(AllowOwner, "AllowObjectOwner"); FlagNames.Add(AllowCSRs, "AllowCSRs"); FlagNames.Add(AllowGhosts, "AllowGhosts"); FlagNames.Add(AllowCats, "AllowCats"); FlagNames.Add(AllowDogs, "AllowDogs"); //FLAGS FlagNames.Add(FlagDebug, "Debug"); FlagNames.Add(FlagLeapfrog, "Leapfrog"); FlagNames.Add(FlagMustRun, "MustRun"); FlagNames.Add(FlagAutoFirst, "AutoFirst"); FlagNames.Add(FlagRunImmediately, "RunImmediately"); FlagNames.Add(FlagConsecutive, "AllowConsecutive"); FlagNames.Add(FlagCarrying, "Carrying"); FlagNames.Add(FlagRepair, "Repair"); FlagNames.Add(FlagCheck, "AlwaysCheck"); FlagNames.Add(FlagDead, "WhenDead"); } }