Exemplo n.º 1
0
 internal void DeleteModel(ModelAction modelAction)
 {
     if (this.models.ContainsKey(modelAction.name))
     {
         Button model = this.models[modelAction.name];
         this.models.Remove(model.name);
         this.modelButtons.Remove(model);
         model.GetComponent <ModelAction>().modelManager = null;
         model.transform.SetParent(null);
         Destroy(model);
         for (int i = 0; i < this.modelButtons.Count; i++)
         {
             PositionButton(i, this.modelButtons[i]);
         }
     }
     else
     {
         Debug.Log("Could not find model to delete: " + modelAction.name);
         Debug.Log("Have: " + models.Keys);
     }
 }
Exemplo n.º 2
0
        private void AddModelButton(string name)
        {
            GameObject buttonObject = (GameObject)Instantiate(Resources.Load("LoadModelButton"));
            Button     button       = buttonObject.GetComponent <Button>();

            button.name = name;
            button.transform.SetParent(this.transform.Find("Models"));
            button.GetComponentInChildren <Text>().text = name;
            int labelIndex = this.models.Count;

            PositionButton(labelIndex, button);
            ModelAction modelAction = buttonObject.AddComponent <ModelAction>();

            modelAction.modelManager = this;
            Button deleteButton = button.transform.Find("X").GetComponent <Button>();
            Button saveButton   = button.transform.Find("V").GetComponent <Button>();

            deleteButton.onClick.AddListener(modelAction.DeleteModel);
            saveButton.onClick.AddListener(modelAction.SaveModel);
            button.onClick.AddListener(modelAction.ImportModel);
            this.models.Add(name, button);
            this.modelButtons.Add(button);
        }
Exemplo n.º 3
0
 internal void ImportModel(ModelAction modelAction)
 {
     Debug.Log("Importing model from action: " + modelAction);
     ImportModel(modelAction.transform.Find("Text").GetComponent <Text>().text);
 }