void Awake() { if (instance != null) { Destroy(this); } instance = this; }
void OpenBag() { isOpen = myBag.activeSelf; if (Input.GetKeyDown(KeyCode.B)) { isOpen = !isOpen; myBag.SetActive(isOpen); InventorManager.RefreshItem(); } }
public void AddNewItem() { if (!playerInventory.itemList.Contains(thisItem)) { for (int i = 0; i < playerInventory.itemList.Count; i++) { if (playerInventory.itemList[i] == null) { playerInventory.itemList[i] = thisItem; break; } } } else { thisItem.itemHeld += 1; } InventorManager.RefreshItem(); }
public SynthesisGUI(bool MakeOwners = false) { InitializeComponent(); Instance = this; bxdaEditorPane1.Units = "lbs"; BXDAViewerPaneForm.Controls.Add(bxdaEditorPane1); if (MakeOwners) { BXDAViewerPaneForm.Owner = this; } BXDAViewerPaneForm.FormClosing += Generic_FormClosing; JointPaneForm.Controls.Add(jointEditorPane1); if (MakeOwners) { JointPaneForm.Owner = this; } JointPaneForm.FormClosing += Generic_FormClosing; RigidNode_Base.NODE_FACTORY = delegate(Guid guid) { return(new OGL_RigidNode(guid)); }; settingsExporter.Click += SettingsExporter_OnClick; Shown += SynthesisGUI_Shown; FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (SkeletonBase != null && !WarnUnsaved()) { e.Cancel = true; } InventorManager.ReleaseInventor(); }); jointEditorPane1.ModifiedJoint += delegate(List <RigidNode_Base> nodes) { if (nodes == null || nodes.Count == 0) { return; } foreach (RigidNode_Base node in nodes) { if (node.GetSkeletalJoint() != null && node.GetSkeletalJoint().cDriver != null && node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>() != null && node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>().radius == 0 && node is OGL_RigidNode) { (node as OGL_RigidNode).GetWheelInfo(out float radius, out float width, out BXDVector3 center); WheelDriverMeta wheelDriver = node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>(); wheelDriver.center = center; wheelDriver.radius = radius; wheelDriver.width = width; node.GetSkeletalJoint().cDriver.AddInfo(wheelDriver); } } }; jointEditorPane1.SelectedJoint += bxdaEditorPane1.SelectJoints; bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) => { List <RigidNode_Base> nodes = new List <RigidNode_Base>(); SkeletonBase.ListAllNodes(nodes); jointEditorPane1.AddSelection(nodes[Meshes.IndexOf(mesh)], true); }; }
public SynthesisGUI() { InitializeComponent(); Instance = this; robotViewer1.LoadSettings(ViewerSettings); bxdaEditorPane1.Units = ViewerSettings.modelUnits; RigidNode_Base.NODE_FACTORY = delegate(Guid guid) { return(new OGL_RigidNode(guid)); }; fileNew.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { SetNew(); }); fileLoad.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { LoadFromInventor(); }); fileOpen.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { OpenExisting(); }); fileSave.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { SaveRobot(false); }); fileSaveAs.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { SaveRobot(true); }); fileExit.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { Close(); }); settingsExporter.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { var defaultValues = BXDSettings.Instance.GetSettingsObject("Exporter Settings"); ExporterSettingsForm eSettingsForm = new ExporterSettingsForm((defaultValues != null) ? (ExporterSettingsForm.ExporterSettingsValues)defaultValues : ExporterSettingsForm.GetDefaultSettings()); eSettingsForm.ShowDialog(this); BXDSettings.Instance.AddSettingsObject("Exporter Settings", eSettingsForm.values); ExporterSettings = eSettingsForm.values; }); settingsViewer.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { var defaultValues = BXDSettings.Instance.GetSettingsObject("Viewer Settings"); ViewerSettingsForm vSettingsForm = new ViewerSettingsForm((defaultValues != null) ? (ViewerSettingsForm.ViewerSettingsValues)defaultValues : ViewerSettingsForm.GetDefaultSettings()); vSettingsForm.ShowDialog(this); BXDSettings.Instance.AddSettingsObject("Viewer Settings", vSettingsForm.values); ViewerSettings = vSettingsForm.values; robotViewer1.LoadSettings(ViewerSettings); bxdaEditorPane1.Units = ViewerSettings.modelUnits; }); helpAbout.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { AboutDialog about = new AboutDialog(); about.ShowDialog(this); }); this.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (SkeletonBase != null && !WarnUnsaved()) { e.Cancel = true; } else { BXDSettings.Save(); } InventorManager.ReleaseInventor(); }); jointEditorPane1.ModifiedJoint += delegate(List <RigidNode_Base> nodes) { if (nodes == null || nodes.Count == 0) { return; } foreach (RigidNode_Base node in nodes) { if (node.GetSkeletalJoint() != null && node.GetSkeletalJoint().cDriver != null && node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>() != null && node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>().radius == 0 && node is OGL_RigidNode) { float radius, width; BXDVector3 center; (node as OGL_RigidNode).GetWheelInfo(out radius, out width, out center); WheelDriverMeta wheelDriver = node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>(); wheelDriver.center = center; wheelDriver.radius = radius; wheelDriver.width = width; node.GetSkeletalJoint().cDriver.AddInfo(wheelDriver); } } }; jointEditorPane1.SelectedJoint += robotViewer1.SelectJoints; jointEditorPane1.SelectedJoint += bxdaEditorPane1.SelectJoints; robotViewer1.NodeSelected += jointEditorPane1.AddSelection; robotViewer1.NodeSelected += bxdaEditorPane1.AddSelection; bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) => { List <RigidNode_Base> nodes = new List <RigidNode_Base>(); SkeletonBase.ListAllNodes(nodes); jointEditorPane1.AddSelection(nodes[Meshes.IndexOf(mesh)], true); }; bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) => { List <RigidNode_Base> nodes = new List <RigidNode_Base>(); SkeletonBase.ListAllNodes(nodes); robotViewer1.SelectJoints(nodes.GetRange(Meshes.IndexOf(mesh), 1)); }; }
public void Cleanup() { InventorManager.ReleaseInventor(); }
public void ItemOnClicked() { InventorManager.UpdateItemInfo(slotInfo); }