Advertisement
diegographics

Untitled

Apr 18th, 2017
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.15 KB | None | 0 0
  1. //MD5Hash:0ac235ba6b28d6909c864ac7f5b49ad5;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using System;
  5. using UnityEditor;
  6. using UnityEngine.Events;
  7. using System.Collections.Generic;
  8.  
  9.  
  10. public class MechEditor : UnityEngine.MonoBehaviour
  11. {
  12.     [HeaderAttribute("UI Elemente")]
  13.     public UnityEngine.UI.Dropdown MechTorso = null;
  14.     public UnityEngine.UI.Dropdown MechArms = null;
  15.     public UnityEngine.UI.Dropdown MechLegs = null;
  16.     public UnityEngine.UI.Dropdown MechHead = null;
  17.     [HeaderAttribute("Mech Editor Hilfsobjekte")]
  18.     public UnityEngine.GameObject Hanging = null;
  19.     public UnityEngine.GameObject Torso = null;
  20.     public UnityEngine.GameObject Arms = null;
  21.     public UnityEngine.GameObject Legs = null;
  22.     public UnityEngine.GameObject Head = null;
  23.     [HeaderAttribute("Deffinition der Komponenten")]
  24.     public MechPart_Torso[] MechTorso_List = null;
  25.     public MechPart_Arm[] MechArm_List = null;
  26.     public MechPart_Leg[] MechLeg_List = null;
  27.     public MechPart_Head[] MechHead_List = null;
  28.  
  29.  
  30.     [ContextMenu("Hilfe")]
  31.     public void ContextMenu()
  32.     {
  33.         UnityEditor.Help.BrowseURL("https://valentinwinkelmann.com/");
  34.     }
  35.     void Start()
  36.     {
  37.         MenuEvents();
  38.         Fill_UI();
  39.     }
  40.     void Update()
  41.     {
  42.     }
  43.     public void MenuEvents()
  44.     {
  45.         UnityEngine.UI.Dropdown Dropdown_Dropdown_Torso = null;
  46.  
  47.         MechTorso.onValueChanged.AddListener(delegate (int arg0)
  48.         {
  49.             BuildMech_Torso(arg0);
  50.         });
  51.         MechArms.onValueChanged.AddListener(delegate (int arg0)
  52.         {
  53.             UnityEngine.Debug.Log(arg0);
  54.         });
  55.         MechLegs.onValueChanged.AddListener(delegate (int arg0)
  56.         {
  57.             UnityEngine.Debug.Log(arg0);
  58.         });
  59.     }
  60.     public void InitializeMech()
  61.     {
  62.     }
  63.     public void BuildMech_Torso(int Index)
  64.     {
  65.         UnityEngine.Debug.Log(MechTorso_List[Index].Description);
  66.         UnityEngine.Debug.Log(MechTorso_List[Index].name);
  67.         if ((Torso.transform.GetChildCount() > 0))
  68.         {
  69.             UnityEngine.Object.Destroy(Torso.transform.GetChild(0).gameObject);
  70.             UnityEngine.Object.Instantiate(MechTorso_List[Index].Prefab, new UnityEngine.Vector3(0f, 0f, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f), Torso.transform);
  71.         }
  72.         else
  73.         {
  74.             UnityEngine.Object.Instantiate(MechTorso_List[Index].Prefab, new UnityEngine.Vector3(0f, 0f, 0f), new UnityEngine.Quaternion(0f, 0f, 0f, 0f), Torso.transform);
  75.         }
  76.  
  77.     }
  78.     public void Fill_UI()
  79.     {
  80.         System.Collections.Generic.List<string> MechTorso_List1 = new System.Collections.Generic.List<string>();
  81.         System.Collections.Generic.List<string> MechArm_List1 = new System.Collections.Generic.List<string>();
  82.         System.Collections.Generic.List<string> MechLeg_List1 = new System.Collections.Generic.List<string>();
  83.         System.Collections.Generic.List<string> MechHead_List1 = new System.Collections.Generic.List<string>();
  84.  
  85.         foreach (var iterator_156 in MechTorso_List)
  86.         {
  87.             MechTorso_List1.Add(iterator_156.name);
  88.         }
  89.         MechTorso.AddOptions(MechTorso_List1);
  90.         foreach (var iterator_173 in MechArm_List)
  91.         {
  92.             MechArm_List1.Add(iterator_173.name);
  93.         }
  94.         MechArms.AddOptions(MechArm_List1);
  95.         foreach (var iterator_186 in MechLeg_List)
  96.         {
  97.             MechLeg_List1.Add(iterator_186.name);
  98.         }
  99.         MechLegs.AddOptions(MechLeg_List1);
  100.         foreach (var iterator_193 in MechHead_List)
  101.         {
  102.             MechHead_List1.Add(iterator_193.name);
  103.         }
  104.         MechHead.AddOptions(MechHead_List1);
  105.     }
  106.     [SerializableAttribute]
  107.     public class MechPart_Torso
  108.     {
  109.         public string name = "";
  110.         public UnityEngine.GameObject Prefab = null;
  111.         [TextAreaAttribute]
  112.         public string Description = "";
  113.  
  114.         public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
  115.         {
  116.         }
  117.     }
  118.     [SerializableAttribute]
  119.     public class MechPart_Arm
  120.     {
  121.         public string name = "";
  122.         public UnityEngine.GameObject Prefab = null;
  123.         [TextAreaAttribute]
  124.         public string Description = "";
  125.     }
  126.     [SerializableAttribute]
  127.     public class MechPart_Leg
  128.     {
  129.         public string name = "";
  130.         public UnityEngine.GameObject Prefab = null;
  131.         [TextAreaAttribute]
  132.         public string Description = "";
  133.     }
  134.     [SerializableAttribute]
  135.     public class MechPart_Head
  136.     {
  137.         public string name = "";
  138.         public UnityEngine.GameObject Prefab = null;
  139.         [TextAreaAttribute]
  140.         public string Description = "";
  141.     }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement