internal static ToolObjectList GetToolObjectListFromToFile(Form form) { try { ToolObjectList toolObjectList = new ToolObjectList(); String fileContent = FileUtil.ReadToEndWithStandardEncoding(Path.Combine(ConstantUtil.ApplicationExecutionPath(), ConstantUtil.toFile)); String[] separator = { Environment.NewLine }; String[] splittedFileContent = fileContent.Split(separator, StringSplitOptions.RemoveEmptyEntries); foreach (String extensionString in splittedFileContent) { separator[0] = "|"; String[] splittedExtensionContent = extensionString.Split(separator, StringSplitOptions.None); ToolObject toolObject = new ToolObject(splittedExtensionContent[0], splittedExtensionContent[1], splittedExtensionContent[2], Convert.ToInt32(splittedExtensionContent[3])); toolObjectList.Add(toolObject); } return(toolObjectList); } catch (Exception) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("ErrorReading", className)); FileListManager.SaveFileList(ConstantUtil.toFile, String.Empty); return(GetToolObjectListFromToFile(form)); } }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Player") { //QUAND ON SORT DE LA ZONE EN VOLANT UN OBJET PlayerManager player = other.gameObject.GetComponent <PlayerManager>(); if (player.IsBringingObject()) { BringObject concernedObj = player.IsBringingObject(); if (concernedObj.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(concernedObj, true); if (concernedObj.GetOwner() == characterOwner) { objectsInZone.Remove(concernedObj.gameObject); } } else if (player.IsBringingTool()) { ToolObject tool = player.IsBringingTool(); if (tool.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(tool, true); if (tool.GetOwner() == characterOwner) { objectsInZone.Remove(tool.gameObject); } } } }
public bool MeetsInteractionRequirements(ObjectProperties heldObject) { if (_anyObjectForInteraction && heldObject == null) { return(false); } bool checkTool = _toolRequiredForInteraction != ToolType.None; bool checkLiquid = _LiquidRequired != Liquid.None; if (checkTool || checkLiquid) { if (heldObject == null || !(heldObject is ToolObject)) { return(false); } else { ToolObject tool = (ToolObject)heldObject; if (checkTool && tool.ToolClassification != _toolRequiredForInteraction) { return(false); } if (checkLiquid && (!tool.CanFill || tool.ContainingLiquid != _LiquidRequired)) { return(false); } } } return(true); }
public PlayerUseToolState(ObjectManager curObject, GameObject toolObject) : base(curObject) { stateName = "PLAYER_USE_TOOL_STATE"; this.curObject = curObject; curPlayer = (PlayerManager)this.curObject; this.toolObject = toolObject.GetComponent <ToolObject>(); this.toolObject.curStatePlayer = this; this.toolObject.IsUsingObject = false; }
internal static ToolObjectList MoveTool(Tools form, ObjectListUtil.Movement move, ToolObjectList toolObjectList) { TreeView toolTreeView = form.toolTreeView; TreeNode selectedNode = toolTreeView.SelectedNode; int selectedNodeIndex = toolTreeView.SelectedNode.Index; ToolObject toolObject = (ToolObject)toolObjectList[selectedNodeIndex]; return((ToolObjectList)ObjectListUtil.MoveObject(move, toolObjectList, toolObject, toolTreeView, selectedNode, selectedNodeIndex)); }
void Start() { mouseDownInArea = false; if (currentToolObject) { SetTool(currentToolObject); } globals = GameObject.FindGameObjectWithTag("Globals").GetComponent <Globals>(); currentToolObject = initiToolObject; }
private static int GetToolPositionInList(IList toolObjectList, String toolDescription) { for (int i = 0; i < toolObjectList.Count; i++) { ToolObject toolObject = (ToolObject)toolObjectList[i]; if (toolObject.Description == toolDescription) { return(i); } } return(-1); }
// Combobox eventhandler, handles category changes private void ChangeValue(object sender, SelectionChangedEventArgs e) { switch (this.window.productCategories.SelectedIndex) { case 1: ElectronicObject eo = new ElectronicObject(); GenerateInputFields(eo); this.window.AddTabChildStack.Background = Brushes.LightBlue; break; case 2: ConstructionObject co = new ConstructionObject(); GenerateInputFields(co); this.window.AddTabChildStack.Background = Brushes.LightCyan; break; case 3: GardenObject go = new GardenObject(); GenerateInputFields(go); this.window.AddTabChildStack.Background = Brushes.LightGreen; break; case 4: SanitaryObject so = new SanitaryObject(); GenerateInputFields(so); this.window.AddTabChildStack.Background = Brushes.LightCoral; break; case 5: ToolObject to = new ToolObject(); GenerateInputFields(to); this.window.AddTabChildStack.Background = Brushes.LightGoldenrodYellow; break; case 6: MachineryObject mo = new MachineryObject(); GenerateInputFields(mo); this.window.AddTabChildStack.Background = Brushes.LightSalmon; break; case 7: AutoPartObject ao = new AutoPartObject(); GenerateInputFields(ao); this.window.AddTabChildStack.Background = Brushes.LightGray; break; default: this.window.AddTabChildStack.Children.RemoveRange(1, this.window.AddTabChildStack.Children.Count - 1); this.window.AddTabChildStack.Background = Brushes.Transparent; this.window.AddButton.IsEnabled = false; break; } }
internal static bool SaveDescription(Tools form, ToolObjectList toolObjectList) { TreeView toolTreeView = form.toolTreeView; TextBox descriptionTextBox = form.descriptionTextBox; if (String.IsNullOrEmpty(descriptionTextBox.Text)) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("NameNotEmpty", className)); descriptionTextBox.Focus(); return(true); } ToolObject selectedToolObject = null; foreach (ToolObject toolObject in toolObjectList) { if (toolObject.Description != toolTreeView.SelectedNode.Text && toolObject.Description == descriptionTextBox.Text) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("AlreadyExists", className)); descriptionTextBox.Focus(); return(true); } if (toolObject.Description == toolTreeView.SelectedNode.Text) { selectedToolObject = toolObject; } } if (selectedToolObject == null) { String error = LanguageUtil.GetCurrentLanguageString("ErrorSaving", className); ToolException exception = new ToolException(error); WindowManager.ShowErrorBox(form, error, exception); return(false); } selectedToolObject.Description = descriptionTextBox.Text; toolTreeView.SelectedNode.Text = selectedToolObject.Description; return(true); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "PNJ" && other.gameObject.GetComponent <PnjManager>().GetCharacterType() == characterOwner) { PnjCheckStealedObjects(); } else if (other.gameObject.tag == "Player") { PlayerManager player = other.gameObject.GetComponent <PlayerManager>(); if (player.IsBringingObject()) { //SI JE REVIENS DANS LA ZONE AVEC UN OBJET DU PERSO BringObject concernedObj = player.IsBringingObject(); // CheckEventObject(concernedObj); if (concernedObj.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(concernedObj, false); if (concernedObj.GetOwner() == characterOwner) { objectsInZone.Add(concernedObj.gameObject); } } else if (player.IsBringingTool()) { ToolObject tool = player.IsBringingTool(); // CheckEventObject(tool); if (tool.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(tool, false); if (tool.GetOwner() == characterOwner) { objectsInZone.Add(tool.gameObject); } } } }
public void SetTool(ToolObject toolObject) { if (currentToolObject) { currentToolObject.ToolDisable(); currentToolObject.gameObject.SetActive(false); } currentToolObject = toolObject; if (currentToolObject) { currentTool = currentToolObject.GetTool(); currentToolObject.gameObject.SetActive(true); currentToolObject.ToolEnable(); } else { currentTool = Tools.Cursor; } }
internal static int AddTool(Tools form, ToolObjectList toolObjectList, int newToolIdentity) { TreeView toolTreeView = form.toolTreeView; TextBox descriptionTextBox = form.descriptionTextBox; TextBox commandLineTextBox = form.commandLineTextBox; TextBox workingFolderTextBox = form.workingFolderTextBox; ComboBox runComboBox = form.runComboBox; Button removeButton = form.removeButton; String newTool = LanguageUtil.GetCurrentLanguageString("New", className); newToolIdentity++; String description = String.Format("{0} ({1})", newTool, newToolIdentity); while (CheckIdentityExists(form, toolObjectList, description)) { newToolIdentity++; description = String.Format("{0} ({1})", newTool, newToolIdentity); } ToolObject toolObject = new ToolObject(description, String.Empty, String.Empty, 0); toolObjectList.Add(toolObject); toolTreeView.Focus(); toolTreeView.Nodes.Add(description); toolTreeView.SelectedNode = toolTreeView.Nodes[toolTreeView.Nodes.Count - 1]; descriptionTextBox.Enabled = true; commandLineTextBox.Enabled = true; workingFolderTextBox.Enabled = true; runComboBox.Enabled = true; removeButton.Enabled = true; return(newToolIdentity); }
internal static ToolObjectList LoadToolsList(Tools form) { TreeView toolTreeView = form.toolTreeView; TextBox descriptionTextBox = form.descriptionTextBox; TextBox commandLineTextBox = form.commandLineTextBox; TextBox workingFolderTextBox = form.workingFolderTextBox; ComboBox runComboBox = form.runComboBox; Button removeButton = form.removeButton; ToolObjectList toolObjectList = new ToolObjectList(); String fileContent = FileUtil.ReadToEndWithStandardEncoding(Path.Combine(ConstantUtil.ApplicationExecutionPath(), ConstantUtil.toFile)); String[] separator = { Environment.NewLine }; String[] splittedFileContent = fileContent.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (splittedFileContent.Length > 0) { toolTreeView.BeginUpdate(); } foreach (String toolString in splittedFileContent) { separator[0] = "|"; String[] splittedExtensionContent = toolString.Split(separator, StringSplitOptions.None); if (splittedExtensionContent.Length != 4) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("ErrorReading", className)); FileListManager.SaveFileList(ConstantUtil.toFile, String.Empty); return(LoadToolsList(form)); } toolTreeView.Nodes.Add(splittedExtensionContent[0]); //DtPad ToolObject toolObject = new ToolObject(splittedExtensionContent[0], splittedExtensionContent[1], splittedExtensionContent[2], Convert.ToInt32(splittedExtensionContent[3])); toolObjectList.Add(toolObject); } if (splittedFileContent.Length > 0) { toolTreeView.EndUpdate(); } toolTreeView.Focus(); if (toolTreeView.Nodes.Count > 0) { toolTreeView.SelectedNode = toolTreeView.Nodes[0]; } else { descriptionTextBox.Enabled = false; commandLineTextBox.Enabled = false; workingFolderTextBox.Enabled = false; runComboBox.Enabled = false; runComboBox.SelectedIndex = 0; removeButton.Enabled = false; } return(toolObjectList); }
public void SetToolObject(ToolObject tool) { bringObject = null; toolObject = tool; }
public void SetBringingObject(BringObject obj) { toolObject = null; bringObject = obj; }