/// <summary> /// Gets the alignment. /// </summary> /// <returns>The alignment.</returns> /// <param name="style">Style.</param> public GameObject GetAlignment(ModleAlignmentStyle style) { switch(style) { case ModleAlignmentStyle.MAS_RIGHTUP: return Child[UM_RIGHTUP]; } return default(GameObject); }
/// <summary> /// Load the specified prefab and nID. /// </summary> /// <param name="prefab">Prefab.</param> /// <param name="nID">N I.</param> public bool Load(GameObject prefab, int nID, ModleAlignmentStyle style) { GameObject alignment = GetAlignment(style); if (!alignment) throw new System.NullReferenceException("can't set style " + style.ToString()); // create modle icon GameObject icon = GameObject.Instantiate(prefab) as GameObject; if (icon) { icon.transform.parent = alignment.transform; icon.transform.name = nID.ToString(); icon.transform.localRotation = alignment.transform.localRotation; RegisterClickEvent(icon, OnIconClicked); } return true; }