Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MD5Hash:0ac235ba6b28d6909c864ac7f5b49ad5;
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using UnityEditor;
- using UnityEngine.Events;
- using System.Collections.Generic;
- public class MechEditor : UnityEngine.MonoBehaviour
- {
- [HeaderAttribute("UI Elemente")]
- public UnityEngine.UI.Dropdown MechTorso = null;
- public UnityEngine.UI.Dropdown MechArms = null;
- public UnityEngine.UI.Dropdown MechLegs = null;
- public UnityEngine.UI.Dropdown MechHead = null;
- [HeaderAttribute("Mech Editor Hilfsobjekte")]
- public UnityEngine.GameObject Hanging = null;
- public UnityEngine.GameObject Torso = null;
- public UnityEngine.GameObject Arms = null;
- public UnityEngine.GameObject Legs = null;
- public UnityEngine.GameObject Head = null;
- [HeaderAttribute("Deffinition der Komponenten")]
- public MechPart_Torso[] MechTorso_List = null;
- public MechPart_Arm[] MechArm_List = null;
- public MechPart_Leg[] MechLeg_List = null;
- public MechPart_Head[] MechHead_List = null;
- [ContextMenu("Hilfe")]
- public void ContextMenu()
- {
- UnityEditor.Help.BrowseURL("https://valentinwinkelmann.com/");
- }
- void Start()
- {
- MenuEvents();
- Fill_UI();
- }
- void Update()
- {
- }
- public void MenuEvents()
- {
- UnityEngine.UI.Dropdown Dropdown_Dropdown_Torso = null;
- MechTorso.onValueChanged.AddListener(delegate (int arg0)
- {
- BuildMech_Torso(arg0);
- });
- MechArms.onValueChanged.AddListener(delegate (int arg0)
- {
- UnityEngine.Debug.Log(arg0);
- });
- MechLegs.onValueChanged.AddListener(delegate (int arg0)
- {
- UnityEngine.Debug.Log(arg0);
- });
- }
- public void InitializeMech()
- {
- }
- public void BuildMech_Torso(int Index)
- {
- UnityEngine.Debug.Log(MechTorso_List[Index].Description);
- UnityEngine.Debug.Log(MechTorso_List[Index].name);
- if ((Torso.transform.GetChildCount() > 0))
- {
- UnityEngine.Object.Destroy(Torso.transform.GetChild(0).gameObject);
- UnityEngine.Object.Instantiate(MechTorso_List[Index].Prefab, new UnityEngine.Vector3(0f, 0f, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f), Torso.transform);
- }
- else
- {
- UnityEngine.Object.Instantiate(MechTorso_List[Index].Prefab, new UnityEngine.Vector3(0f, 0f, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f), Torso.transform);
- }
- }
- public void Fill_UI()
- {
- System.Collections.Generic.List<string> MechTorso_List1 = new System.Collections.Generic.List<string>();
- System.Collections.Generic.List<string> MechArm_List1 = new System.Collections.Generic.List<string>();
- System.Collections.Generic.List<string> MechLeg_List1 = new System.Collections.Generic.List<string>();
- System.Collections.Generic.List<string> MechHead_List1 = new System.Collections.Generic.List<string>();
- foreach (var iterator_156 in MechTorso_List)
- {
- MechTorso_List1.Add(iterator_156.name);
- }
- MechTorso.AddOptions(MechTorso_List1);
- foreach (var iterator_173 in MechArm_List)
- {
- MechArm_List1.Add(iterator_173.name);
- }
- MechArms.AddOptions(MechArm_List1);
- foreach (var iterator_186 in MechLeg_List)
- {
- MechLeg_List1.Add(iterator_186.name);
- }
- MechLegs.AddOptions(MechLeg_List1);
- foreach (var iterator_193 in MechHead_List)
- {
- MechHead_List1.Add(iterator_193.name);
- }
- MechHead.AddOptions(MechHead_List1);
- }
- [SerializableAttribute]
- public class MechPart_Torso
- {
- public string name = "";
- public UnityEngine.GameObject Prefab = null;
- [TextAreaAttribute]
- public string Description = "";
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- {
- }
- }
- [SerializableAttribute]
- public class MechPart_Arm
- {
- public string name = "";
- public UnityEngine.GameObject Prefab = null;
- [TextAreaAttribute]
- public string Description = "";
- }
- [SerializableAttribute]
- public class MechPart_Leg
- {
- public string name = "";
- public UnityEngine.GameObject Prefab = null;
- [TextAreaAttribute]
- public string Description = "";
- }
- [SerializableAttribute]
- public class MechPart_Head
- {
- public string name = "";
- public UnityEngine.GameObject Prefab = null;
- [TextAreaAttribute]
- public string Description = "";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement