Beispiel #1
0
        public HeroKitObject SetupSaveMenu(string menuTitle, int menuID)
        {
            // add menu to scene if it doesn't exist
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.saveMenu, true);

            targetObject.gameObject.SetActive(true);

            // change title
            string     title       = menuTitle;
            GameObject titleObject = HeroKitCommonRuntime.GetChildGameObject(targetObject.gameObject, "SaveMenuTitle", true);
            Text       titleText   = targetObject.GetGameObjectComponent <Text>("Text", false, titleObject);

            titleText.text = title;

            // add save slots
            GameObject parentObject = HeroKitCommonRuntime.GetChildGameObject(targetObject.gameObject, "Save Menu Content", true);

            if (parentObject.transform.childCount == 0)
            {
                HeroKitObject         saveObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.saveSlot, false);
                DuplicateHeroUIObject dup        = new DuplicateHeroUIObject();
                dup.CreateUIObjects(saveObject.gameObject, parentObject, 20, true, saveObject, 1, 4, true);
            }

            // menu type = save
            HeroKitObject[] children = parentObject.transform.GetComponentsInChildren <HeroKitObject>();
            for (int i = 0; i < children.Length; i++)
            {
                children[i].heroList.ints.items[0].value = menuID;
            }

            return(targetObject);
        }
        // This is used by HeroKitCommon.GetAction() to add this action to the ActionDictionary. Don't delete!
        public static DuplicateHeroUIObject Create()
        {
            DuplicateHeroUIObject action = new DuplicateHeroUIObject();

            return(action);
        }