/** * @brief load tree command **/ private void openToolStripMenuItem_Click(object sender, EventArgs e) { string treeName = ResourceSelectorWindow.SelectResource(ResourceSelectorWindow.ObserveType.BTTree, "", this); if (treeName != "") { LoadBTTree(treeName); } }
private void textureBox_Click(object sender, EventArgs e) { // show dialog ResourceSelectorWindow resourceSelector = new ResourceSelectorWindow(); resourceSelector.SetType(ResourceSelectorWindow.ObserveType.Texture); resourceSelector.CanTypeModify(false); resourceSelector.UpdateList(); if (m_texture.value != null) { resourceSelector.Select(m_texture.value.Name); } resourceSelector.ShowDialog(this); if (resourceSelector.DialogResult == DialogResult.OK) { m_texture.value = Mgr <CatProject> .Singleton.contentManger.Load <Texture2D>("image\\" + resourceSelector.GetSelectedString()); m_texture.value.Name = resourceSelector.GetSelectedString(); SetObserve(m_texture); } }
public void RunScript() { if (Mgr <CatProject> .Singleton == null) { return; } // ask for model string modelName = ResourceSelectorWindow.SelectResource(ResourceSelectorWindow.ObserveType.Model, ""); if (modelName == "") { return; } CatModel model = Mgr <CatProject> .Singleton.modelList1.GetModel(modelName); if (model != null) { CatMaterial material = model.GetMaterial(); if (material == null || !material.HasParameter("DiffuseMap")) { // TODO: give warning return; } } else { return; } // ask for texture string textureName = ResourceSelectorWindow.SelectResource(ResourceSelectorWindow.ObserveType.Texture, ""); if (textureName == "") { return; } Texture2D texture = Mgr <CatProject> .Singleton.contentManger.Load <Texture2D>("image\\" + textureName); if (texture == null) { return; } GameObject newGameObject = new GameObject(); if (Mgr <Camera> .Singleton != null) { newGameObject.Position = new Vector3(Mgr <Camera> .Singleton.TargetPosition.X, Mgr <Camera> .Singleton.TargetPosition.Y, 0.0f); } else { newGameObject.Position = Vector3.Zero; } ModelComponent modelComponent = new ModelComponent(newGameObject); newGameObject.AddComponent(modelComponent); modelComponent.Model = model; modelComponent.GetCatModelInstance().GetMaterial().SetParameter("DiffuseMap", new CatTexture(texture)); QuadRender quadRender = new QuadRender(newGameObject); newGameObject.AddComponent(quadRender); quadRender.OptimalSize = true; Mgr <Scene> .Singleton._gameObjectList.AddGameObject(newGameObject); }