// Use this for initialization void Start () { data = DataScript.data; player = PlayerDataScript.playerData; guiInfo = GUIInfo.guiInfo; }
void Start() { playerData = this; data = DataScript.data; SetPlayerState(false); //disables the player by default }
void Awake() { kingdomData = this; data = DataScript.data; SetCastleState (false); castlesArray = castlesParent.GetComponentsInChildren<Castles>(true); for (int i = 0; i < castleCount; i++) { castlesArray[i].castleNumber = i+1; castlesArray[i].SetName ("Unnamed Castle"); } }
// Use this for initialization void Start() { data = DataScript.data; //loads the data script targetArmy = data.armyData; //loads the army data player = data.playerData; //loads the player data int targetArmySize = targetArmy.GetArmySize(); //number of party members in player's party targetArray = new GameObject[targetArmySize + 1]; //create an array of targets including the player //set elements of the target array to player and party for (int i = 0; i < targetArmySize; i++) { //targetArray[i] = targetArmy.partySoldiers[i]; } //set the final element to the player targetArray[targetArray.Length - 1] = player.getPlayerObject(); }
// Use this for initialization void Start() { data = DataScript.data; guiInfo = GUIInfo.guiInfo; }
private void OnCollisionEnter2D(Collision2D collision) { Destroy(gameObject); DataScript.AddScore(250); FindObjectOfType <TGOBreakoutController>().brickCounter--; }
private void openTemplateFile_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { dataScript = ScriptName.SelectedItem as DataScript; dataRule = DataScriptRuleDAL.getInfo(dataScript.FID); System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); if (FileType.SelectedValue.ToString() == "xls/xlsx") { dialog.Filter = "(Excel 文件)|*.xls;*.xlsx"; } else if (FileType.SelectedValue.ToString() == "dat") { dialog.Filter = "(dat 文件)|*.dat"; } else if (FileType.SelectedValue.ToString() == "db") { dialog.Filter = "(sqlite 文件)|*.db"; } else if (FileType.SelectedValue.ToString() == "mdb") { dialog.Filter = "(mdb 文件)|*.mdb"; } else if (FileType.SelectedValue.ToString() == "fws10") { dialog.Filter = "(fws10 文件)|*.fws10"; } else { dialog.Filter = "(文本文件)|*.txt"; } System.Windows.Forms.DialogResult result = dialog.ShowDialog(); DataTable dt = new DataTable(); if (result == System.Windows.Forms.DialogResult.OK) { txtTemplageFile.Text = dialog.FileName; if (FileType.SelectedValue.ToString() == "mdb") { AccessImportHelper helper = new AccessImportHelper(dialog.FileName); dt = helper.getDataTable(); } else if (FileType.SelectedValue.ToString() == "xls/xlsx") { dt = ExcelImportHelper.GetDataTable(dialog.FileName); } else if (FileType.SelectedValue.ToString() == "db") { dt = SQLiteImportHelper.GetDataTable(dialog.FileName); } else { dt = TextImportHelper.GetDataTable(dialog.FileName, dataRule.getColSeperatorChar()); } dataGrid.ItemsSource = dt.AsDataView(); importGrid.ItemsSource = dt; checkStruct(dt, dataScript); } }
// Use this for initialization void Start() { guiInfo = GUIInfo.guiInfo; data = DataScript.data; kingdomData = KingdomDataScript.kingdomData; }
void Awake() { GameObject dataObj = GameObject.Find("Settings"); data = dataObj.GetComponent <DataScript> (); }
public bool init() { var taskInfoList = TaskinfoDAL.getList(userName); if (taskInfoList == null || taskInfoList.Count == 0) { SendMessageEvent(false, string.Format("用户[{0}],无任务数据", userName)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.taskInfo = taskInfoList.FirstOrDefault(it => it.taskCode == taskCode); if (taskInfo == null) { SendMessageEvent(false, string.Format("任务[{0}],不存在", taskCode)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } var dataSource = WebHelper.listTdmTaskTimesInfo(taskInfo.id); if (dataSource.Count(it => it.TestTime == this.times.ToString()) < 1) { SendMessageEvent(false, string.Format("任务 [ {0} ] ,试验次数 [ {1} ] 不存在,", taskCode, this.times)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } string fid = scriptCode2Fid(scriptCode); if (string.IsNullOrEmpty(fid)) { SendMessageEvent(false, string.Format("任务[{0}],不存在", taskCode)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.dataScript = DataScriptDAL.getInfo(fid); if (dataScript == null) { SendMessageEvent(false, string.Format("任务[{0}],不存在", taskCode)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.dataScriptRule = DataScriptRuleDAL.getInfo(fid); if (dataScriptRule == null) { SendMessageEvent(false, string.Format("任务规则[{0}],不存在", fid)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.columnMap = getColumnMap(); if (this.dataScriptRule != null) { this.structList = TableDAL.getTableStructure(this.dataScriptRule.DesTable); } return(true); }
// loads the player name and score and shows it on the bottom left corner void Start() { score.text = "Player: " + DataScript.GetName() + " Score: " + DataScript.GetScore(); }
// every button contains an influence this is used to move the happiness slider right or left. This number is given in the xml file private void BtnAnswer(int btn, int number) { //answered = true; CameraControl.showingPopUp = false; CameraControl.inQuiz = false; modifier = list.questionEntries[number].answers[btn].modifier; //All code for ScoreCanvas // //Add questionList to QnA question list FindObjectOfType <QnAscore>().questionList.Add(list.questionEntries[number].question); //check which answer is correct answer and add to CorrectAnswerList for (int i = 0; i < ansCount; i++) { if (list.questionEntries[number].answers[i].modifier > 0) { FindObjectOfType <QnAscore>().correctAnsList.Add(list.questionEntries[number].answers[i].answer); } } //Add player answer to PlayerAnswerList FindObjectOfType <QnAscore>().playerAnsList.Add(list.questionEntries[number].answers[btn].answer); // if (modifier < 0) { if (EndOfGame.NumberOfCorrectAnswers > 0) { EndOfGame.NumberOfCorrectAnswers = 0; } EndOfGame.NumberOfCorrectAnswers--; } if (modifier > 0) { if (EndOfGame.NumberOfCorrectAnswers < 0) { EndOfGame.NumberOfCorrectAnswers = 0; } EndOfGame.NumberOfCorrectAnswers++; switch (sceneName) { case "Producer": case "DGO": case "Supplier": AdjustMoney(modifier * 1000); break; default: break; } } DataScript.AddScore(modifier * 100); for (int i = 0; i < ansCount; i++) { if (list.questionEntries[number].answers[i].modifier > 0) { answerBtns[i].GetComponent <Image>().color = Color.green; } else { answerBtns[i].GetComponent <Image>().color = Color.red; } } }
// Use this for initialization void Start() { ds = GameObject.Find("GaudyBG").GetComponent <DataScript> (); }
/** * Adds the active tab to the dictionary */ public void AddToDictionary() { //GetSectionImages (); //If another tab has specified another AddToDictionary method, use that one if (MethodToCall != null) { MethodToCall(); if (!sameTab) { MethodToCall = null; } return; } else { if (currentTab == null) { return; } string xml = "<data>"; string imageData = "<images>"; int imgCount = 0; //string customName = ds.GetData (currentSection).getTabInfo (currentTab.name + currentTab.GetComponent<Text>().text).customName; //xml += "<customName>" + customName + "</customName><data>"; //Sets up the XML string to be passed into the dictionary allChildren = currentTab.GetComponentsInChildren <Transform>(); Transform nextChild = null; string UID = ""; foreach (Transform child in allChildren) { //Debug.Log(child.name); if (child != null) { if (child.tag.Equals("Image")) //Handle images { Sprite img = child.GetComponent <Image>().sprite; imageData += "<image" + imgCount + ">"; UID = child.GetComponent <OpenImageUploadPanelScript>().GetGuid(); imageData += "<key>" + UID + "</key>"; //imageData += "<key>" + currentSection + currentTab.transform.Find ("TabButtonLinkToText").GetComponent<Text>().text + "</key>"; string imgRef; if ((imgRef = ds.GetImage(currentSection + currentTab.transform.Find("TabButtonLinkToText").GetComponent <TextMeshProUGUI>().text).referenceName) != null) { imageData += imgRef; } else { imageData += "<width>" + img.texture.width + "</width><height>" + img.texture.height + "</height>"; Texture2D dictTexture = img.texture; Texture2D newTexture = new Texture2D(dictTexture.width, dictTexture.height, TextureFormat.ARGB32, false); newTexture.SetPixels(0, 0, dictTexture.width, dictTexture.height, dictTexture.GetPixels()); newTexture.Apply(); byte[] bytes = newTexture.EncodeToPNG(); string base64Data = Convert.ToBase64String(bytes); imageData += "<data>" + base64Data + "</data>"; } imageData += "</image" + imgCount + ">"; imgCount++; } else if (child.GetComponent <HistoryFieldManagerScript>() != null) { xml += child.GetComponent <HistoryFieldManagerScript>().getData(); Transform tempChild = child; while (nextChild == null) { if (tempChild.GetSiblingIndex() + 1 == tempChild.parent.childCount) { tempChild = tempChild.parent; } else { nextChild = tempChild.parent.GetChild(tempChild.GetSiblingIndex() + 1); } } } else if (nextChild == null && (child.name.ToLower().EndsWith("value") || child.name.ToLower().EndsWith("toggle") || child.tag.Equals("Value"))) //Input object/field { if (child.gameObject.GetComponent <Toggle>() != null) { if (true) // || child.gameObject.GetComponent<Toggle> ().isOn) { //Leaving as true for now. May change later { xml += "<" + child.name + ">"; xml += child.gameObject.GetComponent <Toggle>().isOn; xml += "</" + child.name + ">"; } } else if (child.name.ToLower().EndsWith("toggle") || child.name.ToLower().EndsWith("radio")) { continue; } else { xml += "<" + child.name + ">"; //Handle reading the child if (child.gameObject.GetComponent <InputField>() != null) { xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <InputField>().text); } else if (child.gameObject.GetComponent <Text>() != null) { xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <Text>().text); } else if (child.gameObject.GetComponent <Dropdown>() != null) { xml += UnityWebRequest.EscapeURL(child.gameObject.GetComponent <Dropdown>().captionText.text); } else if (child.name.Equals("DialoguePin") || child.name.Equals("QuizPin") || child.name.Equals("FlagPin") || child.name.Equals("EventPin")) { Transform uniqueParent = child; string path = ""; while (uniqueParent.parent != null && !uniqueParent.parent.name.Equals("Content")) { uniqueParent = uniqueParent.parent; } path = uniqueParent.name; while (!uniqueParent.name.EndsWith("Tab")) //Once you hit the Tab container { uniqueParent = uniqueParent.parent; path = uniqueParent.name + "/" + path; } path = getCurrentSection() + "/" + path; //If the dialogue entry has been moved, adjust the dictionary accordingly if (child.name.Equals("DialoguePin") && ds.GetDialogues().ContainsKey(path)) { string dialogueXML = ds.GetDialogues()[path]; //Dialogue data ds.AddDialogue(path, dialogueXML); xml += dialogueXML; } else if (child.name.Equals("DialoguePin")) { xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length); continue; } //If the quiz entry has been moved, adjust the dictionary accordingly if (child.name.Equals("QuizPin") && ds.GetQuizes().ContainsKey(path)) { string quizXML = ds.GetQuizes()[path]; //Quiz data ds.AddQuiz(path, quizXML); xml += quizXML; } else if (child.name.Equals("QuizPin")) { xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length); continue; } if (child.name.Equals("FlagPin") && ds.GetFlags().ContainsKey(path)) { string flagXML = ds.GetFlags()[path]; //Dialogue data ds.AddFlag(path, flagXML); xml += flagXML; } else if (child.name.Equals("FlagPin")) { xml = xml.Substring(0, xml.Length - ("<" + child.name + ">").Length); continue; } } xml += "</" + child.name + ">"; } } if (child == nextChild) { nextChild = null; } } } imageData += "</images>"; xml += "</data>"; //Add the current Tab to the Dictionary. Replace any existing tab if it exists if (ds == null) { ds = GameObject.Find("GaudyBG").GetComponentInChildren <DataScript>(); } //ds.AddData (currentSection, tabName, xml); ds.AddData(currentSection, currentTab.name.Substring(0, currentTab.name.Length - 3), xml); Debug.Log("Saved value: " + xml); } }
// every button contains an influence this is used to move the happiness slider right or left. This number is given in the xml file private void BtnAnswer(int btn, int number) { //answered = true; CameraControl.showingPopUp = false; CameraControl.inQuiz = false; XmlNodeList elemlist = doc.GetElementsByTagName(parenttag); XmlNodeList list = elemlist[number].ChildNodes[1].ChildNodes; int influence = int.Parse(list[btn].Attributes[childattribute].Value); XmlNodeList tekstList = doc.GetElementsByTagName(childquestiontag); //All code for ScoreCanvas // //Add questionList to QnA question list FindObjectOfType <QnAscore>().questionList.Add(tekstList[number].InnerText); //check which answer is correct answer and add to CorrectAnswerList for (int i = 0; i < elemlist[number].ChildNodes[1].ChildNodes.Count; i++) { if (int.Parse(elemlist[number].ChildNodes[1].ChildNodes[i].Attributes[childattribute].Value) > 0) { FindObjectOfType <QnAscore>().correctAnsList.Add(elemlist[number].ChildNodes[1].ChildNodes[i].InnerText); } } //Add player answer to PlayerAnswerList FindObjectOfType <QnAscore>().playerAnsList.Add(elemlist[number].ChildNodes[1].ChildNodes[btn].InnerText); // if (influence < 0) { if (EndOfGame.NumberOfCorrectAnswers > 0) { EndOfGame.NumberOfCorrectAnswers = 0; } EndOfGame.NumberOfCorrectAnswers--; } if (influence > 0) { if (EndOfGame.NumberOfCorrectAnswers < 0) { EndOfGame.NumberOfCorrectAnswers = 0; } EndOfGame.NumberOfCorrectAnswers++; switch (sceneName) { case "Producer": case "DGO": case "Supplier": AdjustMoney(influence * 1000); break; default: break; } } DataScript.AddScore(influence * 100); for (int i = 0; i < list.Count; i++) { if (int.Parse(list[i].Attributes[childattribute].Value) > 0) { answerBtns[i].GetComponent <Image>().color = Color.green; } else { answerBtns[i].GetComponent <Image>().color = Color.red; } } }
void Start() { data = DataScript.data; //sets the data variable armyData = ArmyDataScript.armyData; //sets the armyData variable /* Sets a null button */ nullButton.buttonRect = new Rect(0,0,0,0); nullButton.soldierIndex = -1; //creates an array of party buttons partyButtonsArray = new soldierButton[ArmyDataScript.partyCap]; //creates an array of army buttons that will be displayed armyButtonsArray = new soldierButton[ArmyDataScript.armyCap]; }
// interpolate the measurements at a spicific position to queryLayer float interpolatePoint2Layer(DataScript measured, int row, float[,] pos, int[] measureIndex, int queryLayer, int layerCount) { //float out; Vector3 firstPoint, secondPoint, queryPoint = new Vector3(pos[0, queryLayer], pos[1, queryLayer], pos[2, queryLayer]); int i, prevLayer = -1, nextLayer = -1; if (measureIndex[queryLayer] != -1) { return(measured.Value(row, measureIndex[queryLayer])); } else { // find first valid measurement in previous layers for (i = queryLayer - 1; i > 0; i--) { if (measureIndex[i] != -1) { prevLayer = i; break; } } // find first valid measurement in next layers for (i = queryLayer + 1; i < layerCount; i++) { if (measureIndex[i] != -1) { nextLayer = i; break; } } if (prevLayer == -1) { // No measurement bofore query layer prevLayer = nextLayer; for (i = prevLayer + 1; i < layerCount; i++) { if (measureIndex[i] != -1) { nextLayer = i; break; } } if (nextLayer == prevLayer) { return(measured.Value(row, measureIndex[prevLayer])); } } else if (nextLayer == -1) { // No measurement after query layer nextLayer = prevLayer; for (i = nextLayer - 1; i > 0; i--) { if (measureIndex[i] != -1) { nextLayer = i; break; } } if (nextLayer == prevLayer) { return(measured.Value(row, measureIndex[nextLayer])); } } } firstPoint = new Vector3(pos[0, prevLayer], pos[1, prevLayer], pos[2, prevLayer]); secondPoint = new Vector3(pos[0, nextLayer], pos[1, nextLayer], pos[2, nextLayer]); if (queryLayer > prevLayer && queryLayer < nextLayer) { return(linInterp(measured.Value(row, measureIndex[prevLayer]), measured.Value(row, measureIndex[nextLayer]), firstPoint, secondPoint, queryPoint)); } else { return(linExtrap(measured.Value(row, measureIndex[prevLayer]), measured.Value(row, measureIndex[nextLayer]), firstPoint, secondPoint, queryPoint)); } }
private Animator playerAnimator; //the animator component attached to the player sprite #endregion Fields #region Methods // Use this for initialization void Start() { data = GameObject.Find ("Data").GetComponent<DataScript>(); playerAnimator = GetComponent<Animator>(); //sets to the proper animator }
// Use this for initialization void Awake() { data = DataScript.data; guiInfo = GUIInfo.guiInfo; }
// Use this for initialization void Start() { d = DataScript.getInstance(); myselfButton = GetComponent <Button>(); myselfButton.onClick.AddListener(() => StartBluetooth()); }
// Use this for initialization void Start() { ds = transform.GetComponent <DataScript>(); fileName = GlobalData.fileName; path = GlobalData.filePath; }
void Awake() { if (data == null) { DontDestroyOnLoad (this); data = this; } else if (data != this) { Destroy (gameObject); } }
// Use this for initialization void Start() { instance = this; catchData(); }