예제 #1
0
		public void Copy (CursorIcon _cursorIcon)
		{
			label = _cursorIcon.label;
			lineID = _cursorIcon.lineID;
			id = _cursorIcon.id;

			base.Copy (_cursorIcon);
		}
예제 #2
0
        protected void ShowContextIcons(InvItem invItem)
        {
            if (KickStarter.cursorManager.cursorIcons.Count > 0)
            {
                if (invItem.lookActionList != null && CanDisplayIconsSideBySide())
                {
                    if (invItem.useIconID < 0)
                    {
                        // Hide use
                        if (invItem.lookActionList != null)
                        {
                            CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);
                            DrawIcon(icon, true);
                        }
                        return;
                    }
                    else
                    {
                        CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(invItem.useIconID);
                        DrawIcon(new Vector2(-icon.size * ACScreen.width / 2f, 0f), icon, false);
                    }
                }
                else if (CanCycleContextSensitiveMode() && contextCycleExamine && invItem.lookActionList != null)
                {
                }
                else
                {
                    DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(invItem.useIconID), false);
                    return;
                }

                if (invItem.lookActionList != null)
                {
                    CursorIcon lookIcon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);

                    if (invItem.lookActionList != null && CanDisplayIconsSideBySide())
                    {
                        DrawIcon(new Vector2(lookIcon.size * ACScreen.width / 2f, 0f), lookIcon, true);
                    }
                    else if (CanCycleContextSensitiveMode())
                    {
                        if (contextCycleExamine)
                        {
                            DrawIcon(Vector2.zero, lookIcon, true);
                        }
                    }
                    else
                    {
                        DrawIcon(lookIcon, true);
                    }
                }
            }
        }
        /**
         * <summary>Copies the values from another CursorIcon.</summary>
         * <param name = "_cursorIcon">The CursorIcon to copy from</param>
         * <param name = "includeTranslations">If True, then translation data will also be copied</param>
         */
        public void Copy(CursorIcon _cursorIcon, bool includeTranslation)
        {
            label = _cursorIcon.label;
            if (includeTranslation)
            {
                lineID = _cursorIcon.lineID;
            }
            id        = _cursorIcon.id;
            dontCycle = _cursorIcon.dontCycle;

            base.Copy(_cursorIcon);
        }
예제 #4
0
        private void ShowContextIcons()
        {
            Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot();

            if (hotspot == null)
            {
                return;
            }

            if (hotspot.HasContextUse())
            {
                if (!hotspot.HasContextLook())
                {
                    DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(hotspot.GetFirstUseButton().iconID), false);
                    return;
                }
                else
                {
                    Button _button = hotspot.GetFirstUseButton();

                    if (hotspot.HasContextUse() && hotspot.HasContextLook() && CanDisplayIconsSideBySide())
                    {
                        CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(_button.iconID);
                        DrawIcon(new Vector2(-icon.size * Screen.width / 2f, 0f), icon, false);
                    }
                    else
                    {
                        DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(_button.iconID), false);
                    }
                }
            }

            if (hotspot.HasContextLook() &&
                (!hotspot.HasContextUse() ||
                 (hotspot.HasContextUse() && CanDisplayIconsSideBySide())))
            {
                if (KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);

                    if (hotspot.HasContextUse() && hotspot.HasContextLook() && CanDisplayIconsSideBySide())
                    {
                        DrawIcon(new Vector2(icon.size * Screen.width / 2f, 0f), icon, true);
                    }
                    else
                    {
                        DrawIcon(icon, true);
                    }
                }
            }
        }
예제 #5
0
        /**
         * <summary>A Constructor that sets all its values by copying another InvItem.</summary>
         * <param name = "assetItem">The InvItem to copy</param>
         */
        public InvItem(InvItem assetItem)
        {
            count       = assetItem.count;
            tex         = assetItem.tex;
            activeTex   = assetItem.activeTex;
            selectedTex = assetItem.selectedTex;

            //cursorIcon = assetItem.cursorIcon;
            cursorIcon = new CursorIcon();
            cursorIcon.Copy(assetItem.cursorIcon);

            carryOnStart           = assetItem.carryOnStart;
            carryOnStartNotDefault = assetItem.carryOnStartNotDefault;
            carryOnStartID         = assetItem.carryOnStartID;
            canCarryMultiple       = assetItem.canCarryMultiple;
            label     = assetItem.label;
            altLabel  = assetItem.altLabel;
            id        = assetItem.id;
            lineID    = assetItem.lineID;
            useIconID = assetItem.useIconID;

            binID = assetItem.binID;
            if (binID == -1 && KickStarter.inventoryManager != null && KickStarter.inventoryManager.bins != null && KickStarter.inventoryManager.bins.Count > 0)
            {
                // Place item in first available cateogry if undefined
                binID = KickStarter.inventoryManager.bins[0].id;
            }

            useSeparateSlots = assetItem.useSeparateSlots;
            selectSingle     = assetItem.selectSingle;
            isEditing        = false;
            recipeSlot       = -1;

            overrideUseSyntax = assetItem.overrideUseSyntax;
            hotspotPrefix1    = assetItem.hotspotPrefix1;
            hotspotPrefix2    = assetItem.hotspotPrefix2;

            useActionList              = assetItem.useActionList;
            lookActionList             = assetItem.lookActionList;
            interactions               = assetItem.interactions;
            combineActionList          = assetItem.combineActionList;
            unhandledActionList        = assetItem.unhandledActionList;
            unhandledCombineActionList = assetItem.unhandledCombineActionList;
            combineID    = assetItem.combineID;
            vars         = assetItem.vars;
            linkedPrefab = assetItem.linkedPrefab;

            canBeAnimated = DetermineCanBeAnimated();
        }
예제 #6
0
 /**
  * <summary>A Constructor based on the linked InvItem's ID</summary>
  * <param name="_itemID">The ID number of the associated InvItem</param>
  * <param name="_count">The amount of that item to reference</param>
  */
 public InvInstance(int _itemID, int _count = 1)
 {
     itemID  = _itemID;
     invItem = (KickStarter.inventoryManager) ? KickStarter.inventoryManager.GetItem(itemID) : null;
     if (invItem != null)
     {
         invItem.Upgrade();
     }
     Count      = _count;
     invVars    = new List <InvVar>();
     cursorIcon = (invItem != null) ? new CursorIcon(invItem.cursorIcon) : null;
     matchingInvInteractionData = null;
     lastInteractionIndex       = 0;
     GenerateDefaultProperties();
 }
예제 #7
0
        protected override void AutoSize()
        {
            CursorIcon _icon = GetIconAtSlot(0);

            if (displayType == AC_DisplayType.IconOnly && _icon != null && _icon.texture != null)
            {
                GUIContent content = new GUIContent(_icon.texture);
                AutoSize(content);
            }
            else
            {
                GUIContent content = new GUIContent(TranslateLabel(GetLabel(0, Options.GetLanguage()), Options.GetLanguage()));
                AutoSize(content);
            }
        }
예제 #8
0
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void RecalculateSize(MenuSource source)
        {
            if (AdvGame.GetReferences().cursorManager)
            {
                CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                if (_icon != null)
                {
                    icon  = _icon;
                    label = _icon.label;
                    icon.Reset();
                }
            }

            base.RecalculateSize(source);
        }
예제 #9
0
 /**
  * <summary>A Constructor based on the linked InvItem</summary>
  * <param name="_itemID">The associated InvItem</param>
  * <param name="_count">The amount of that item to reference</param>
  */
 public InvInstance(InvItem _invItem, int _count = 1)
 {
     invItem = _invItem;
     if (invItem != null)
     {
         invItem.Upgrade();
     }
     itemID     = (invItem != null) ? invItem.id : -1;
     Count      = _count;
     invVars    = new List <InvVar>();
     cursorIcon = (invItem != null) ? new CursorIcon(invItem.cursorIcon) : null;
     matchingInvInteractionData = null;
     lastInteractionIndex       = 0;
     GenerateDefaultProperties();
 }
예제 #10
0
 /**
  * <summary>A Constructor based on the linked InvItem's name</summary>
  * <param name="_itemName">The name number of the associated InvItem</param>
  * <param name="_count">The amount of that item to reference</param>
  */
 public InvInstance(string _itemName, int _count = 1)
 {
     invItem = (KickStarter.inventoryManager) ? KickStarter.inventoryManager.GetItem(_itemName) : null;
     if (invItem != null)
     {
         invItem.Upgrade();
     }
     Count      = _count;
     itemID     = (invItem != null) ? invItem.id : -1;
     invVars    = new List <InvVar> ();
     cursorIcon = (invItem != null) ? new CursorIcon(invItem.cursorIcon) : null;
     matchingInvInteractionData = null;
     lastInteractionIndex       = 0;
     GenerateDefaultProperties();
     canBeAnimated = DetermineCanBeAnimated();
 }
예제 #11
0
 /**
  * <summary>A Constructor based on a Container item</summary>
  * <param name="containerItem">The Container item to create an instance from</param>
  */
 public InvInstance(ContainerItem containerItem)
 {
     itemID  = containerItem.ItemID;
     invItem = (KickStarter.inventoryManager) ? KickStarter.inventoryManager.GetItem(itemID) : null;
     if (invItem != null)
     {
         invItem.Upgrade();
     }
     Count      = containerItem.Count;
     invVars    = new List <InvVar> ();
     cursorIcon = (invItem != null) ? new CursorIcon(invItem.cursorIcon) : null;
     matchingInvInteractionData = null;
     lastInteractionIndex       = 0;
     GenerateDefaultProperties();
     canBeAnimated = DetermineCanBeAnimated();
 }
예제 #12
0
        /**
         * <summary>A Constructor that sets all its values by copying another InvItem.</summary>
         * <param name = "assetItem">The InvItem to copy</param>
         */
        public InvItem(InvItem assetItem)
        {
            count       = assetItem.count;
            tex         = assetItem.tex;
            activeTex   = assetItem.activeTex;
            selectedTex = assetItem.selectedTex;

            //cursorIcon = assetItem.cursorIcon;
            cursorIcon = new CursorIcon();
            cursorIcon.Copy(assetItem.cursorIcon);

            carryOnStart           = assetItem.carryOnStart;
            carryOnStartNotDefault = assetItem.carryOnStartNotDefault;
            carryOnStartID         = assetItem.carryOnStartID;
            canCarryMultiple       = assetItem.canCarryMultiple;
            label            = assetItem.label;
            altLabel         = assetItem.altLabel;
            id               = assetItem.id;
            lineID           = assetItem.lineID;
            useIconID        = assetItem.useIconID;
            binID            = assetItem.binID;
            useSeparateSlots = assetItem.useSeparateSlots;
            selectSingle     = assetItem.selectSingle;
            isEditing        = false;
            recipeSlot       = -1;

            overrideUseSyntax = assetItem.overrideUseSyntax;
            hotspotPrefix1    = assetItem.hotspotPrefix1;
            hotspotPrefix2    = assetItem.hotspotPrefix2;

            useActionList              = assetItem.useActionList;
            lookActionList             = assetItem.lookActionList;
            interactions               = assetItem.interactions;
            combineActionList          = assetItem.combineActionList;
            unhandledActionList        = assetItem.unhandledActionList;
            unhandledCombineActionList = assetItem.unhandledCombineActionList;
            combineID    = assetItem.combineID;
            vars         = assetItem.vars;
            linkedPrefab = assetItem.linkedPrefab;

            canBeAnimated = DetermineCanBeAnimated();
        }
예제 #13
0
        private void ShowContextIcons(InvItem invItem)
        {
            if (KickStarter.cursorManager.cursorIcons.Count > 0)
            {
                if (invItem.lookActionList != null && CanDisplayIconsSideBySide())
                {
                    if (invItem.useIconID < 0)
                    {
                        // Hide use
                        if (invItem.lookActionList != null)
                        {
                            CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);
                            DrawIcon(icon, true);
                        }
                        return;
                    }
                    else
                    {
                        CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(invItem.useIconID);
                        DrawIcon(new Vector2(-icon.size * Screen.width / 2f, 0f), icon, false);
                    }
                }
                else
                {
                    DrawIcon(KickStarter.cursorManager.GetCursorIconFromID(invItem.useIconID), false);
                }

                if (invItem.lookActionList != null)
                {
                    CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID(KickStarter.cursorManager.lookCursor_ID);

                    if (invItem.lookActionList != null && CanDisplayIconsSideBySide())
                    {
                        DrawIcon(new Vector2(icon.size * Screen.width / 2f, 0f), icon, true);
                    }
                    else
                    {
                        DrawIcon(icon, true);
                    }
                }
            }
        }
예제 #14
0
        public CursorIcon(CursorIcon cursorIcon)
        {
            dontCycle = cursorIcon.dontCycle;
            label     = cursorIcon.label;
            lineID    = cursorIcon.lineID;
            id        = cursorIcon.id;

            texture                   = cursorIcon.texture;
            isAnimated                = cursorIcon.isAnimated;
            numFrames                 = cursorIcon.numFrames;
            numRows                   = cursorIcon.numRows;
            numCols                   = cursorIcon.numCols;
            size                      = cursorIcon.size;
            animSpeed                 = cursorIcon.animSpeed;
            endAnimOnLastFrame        = cursorIcon.endAnimOnLastFrame;
            skipFirstFrameWhenLooping = cursorIcon.skipFirstFrameWhenLooping;
            clickOffset               = cursorIcon.clickOffset;
            frameSpeeds               = cursorIcon.frameSpeeds;
            alwaysAnimate             = cursorIcon.alwaysAnimate;
        }
예제 #15
0
        private void GetMainIcon()
        {
            if (mainIcon != null)
            {
                return;
            }

            if (KickStarter.cursorManager == null)
            {
                return;
            }

            if (provideUseInteraction && useButton != null && useButton.iconID >= 0 && !useButton.isDisabled)
            {
                mainIcon = new CursorIcon();
                mainIcon.Copy(KickStarter.cursorManager.GetCursorIconFromID(useButton.iconID));
                return;
            }

            if (provideLookInteraction && lookButton != null && lookButton.iconID >= 0 && !lookButton.isDisabled)
            {
                mainIcon = new CursorIcon();
                mainIcon.Copy(KickStarter.cursorManager.GetCursorIconFromID(lookButton.iconID));
                return;
            }

            if (provideUseInteraction && useButtons != null && useButtons.Count > 0)
            {
                for (int i = 0; i < useButtons.Count; i++)
                {
                    if (!useButtons[i].isDisabled)
                    {
                        mainIcon = new CursorIcon();
                        mainIcon.Copy(KickStarter.cursorManager.GetCursorIconFromID(useButtons[i].iconID));
                        return;
                    }
                }
            }

            return;
        }
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void RecalculateSize(MenuSource source)
        {
            if (AdvGame.GetReferences().cursorManager)
            {
                CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                if (_icon != null)
                {
                    icon = _icon;
                    if (Application.isPlaying)
                    {
                        label = KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage());
                    }
                    else
                    {
                        label = _icon.label;
                    }
                    icon.Reset();
                }
            }

            base.RecalculateSize(source);
        }
예제 #17
0
        /**
         * <summary>The default Constructor.</summary>
         * <param name = "idArray">An array of already-used ID numbers, so that a unique ID number can be assigned</param>
         */
        public InvItem(int[] idArray)
        {
            count                  = 0;
            tex                    = null;
            activeTex              = null;
            selectedTex            = null;
            cursorIcon             = new CursorIcon();
            id                     = 0;
            binID                  = -1;
            maxCount               = 999;
            carryOnStartNotDefault = false;
            vars                   = new List <InvVar>();
            canBeAnimated          = false;
            linkedPrefab           = null;
            canBeLowerCase         = false;
            itemStackingMode       = ItemStackingMode.All;

            interactions = new List <InvInteraction>();

            combineActionList = new List <ActionListAsset>();
            combineID         = new List <int>();

            overrideUseSyntax = false;
            hotspotPrefix1    = new HotspotPrefix("Use");
            hotspotPrefix2    = new HotspotPrefix("on");

            // Update id based on array
            foreach (int _id in idArray)
            {
                if (id == _id)
                {
                    id++;
                }
            }

            label    = "Inventory item " + (id + 1).ToString();
            altLabel = "";
        }
예제 #18
0
 /**
  * <summary>A Constructor that copies values of another class instance</summary>
  * <param name="invInstance">The class instance to copy from</param>
  */
 public InvInstance(InvInstance invInstance)
 {
     if (IsValid(invInstance))
     {
         itemID     = invInstance.itemID;
         invItem    = invInstance.invItem;
         invVars    = invInstance.invVars;
         cursorIcon = invInstance.cursorIcon;
         matchingInvInteractionData = invInstance.matchingInvInteractionData;
         lastInteractionIndex       = invInstance.lastInteractionIndex;
         Count = invInstance.count;
     }
     else
     {
         itemID     = -1;
         count      = -1;
         invItem    = null;
         invVars    = null;
         cursorIcon = null;
         matchingInvInteractionData = null;
         lastInteractionIndex       = 0;
     }
 }
예제 #19
0
 /**
  * <summary>Sets the cursor to an icon defined in CursorManager.</summary>
  * <param name = "_icon">The cursor, within CursorManager's cursorIcons List, to select</param>
  */
 public void SetCursor(CursorIcon _icon)
 {
     selectedCursor = KickStarter.cursorManager.cursorIcons.IndexOf (_icon);
 }
예제 #20
0
 /**
  * <summary>Sets the cursor to an icon defined in CursorManager.</summary>
  * <param name = "_icon">The cursor, within CursorManager's cursorIcons List, to select</param>
  */
 public void SetCursor(CursorIcon _icon)
 {
     KickStarter.runtimeInventory.SetNull();
     selectedCursor = KickStarter.cursorManager.cursorIcons.IndexOf(_icon);
 }
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch (System.Exception e)
            {
                ACDebug.LogError("Wizard aborted - Could not create directory: " + Application.dataPath + "/" + managerPath + ". Please make sure the Assets direcrory is writeable, and that the intended game name contains no special characters.");
                Debug.LogException(e, this);
                pageNumber--;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movingTurning     = movingTurning;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (defaultActionsManager != null)
                {
                    references.actionsManager.defaultClass     = defaultActionsManager.defaultClass;
                    references.actionsManager.defaultClassName = defaultActionsManager.defaultClassName;
                }

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;

                references.speechManager.ClearLanguages();

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                CursorManager defaultCursorManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (defaultCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon();
                        useIcon.Copy(defaultCursorManager.cursorIcons[0]);
                        references.cursorManager.cursorIcons.Add(useIcon);
                        EditorUtility.SetDirty(references.cursorManager);
                    }
                }
                else
                {
                    if (defaultCursorManager != null)
                    {
                        foreach (CursorIcon defaultIcon in defaultCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(defaultIcon);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase();
                        pointerIcon.Copy(defaultCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_CursorManager asset to copy from!");
                    }
                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager defaultMenuManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (defaultMenuManager != null)
                    {
                                                #if UNITY_EDITOR
                        references.menuManager.drawOutlines = defaultMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = defaultMenuManager.drawInEditor;
                                                #endif
                        references.menuManager.pauseTexture = defaultMenuManager.pauseTexture;

                        if (wizardMenu != WizardMenu.Blank)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }
                        foreach (Menu defaultMenu in defaultMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(defaultMenu, true, true);
                            newMenu.Recalculate();

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;
                            }

                            if (defaultMenu.canvas)
                            {
                                string newCanvasPath = "Assets/" + gameName + "/UI/" + defaultMenu.canvas.name + ".prefab";

                                GameObject canvasObInScene = (GameObject)PrefabUtility.InstantiatePrefab(defaultMenu.canvas.gameObject);
                                PrefabUtility.DisconnectPrefabInstance(canvasObInScene);
                                GameObject canvasObNewPrefab = PrefabUtility.CreatePrefab(newCanvasPath, canvasObInScene);

                                newMenu.canvas = canvasObNewPrefab.GetComponent <Canvas>();
                                DestroyImmediate(canvasObInScene);

                                newMenu.rectTransform = null;
                            }

                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                            }
                            AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                            newMenu.hideFlags = HideFlags.HideInHierarchy;

                            references.menuManager.menus.Add(newMenu);
                        }

                        EditorUtility.SetDirty(references.menuManager);
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();
                if (GameObject.FindObjectOfType <KickStarter>() == null)
                {
                    bool initScene = EditorUtility.DisplayDialog("Setup scene?", "Process complete.  Would you like to organise the scene objects to begin working?  This can be done at any time within the Scene Manager.", "Yes", "No");
                    if (initScene)
                    {
                        references.sceneManager.InitialiseObjects();
                    }
                }
            }
            catch (System.Exception e)
            {
                ACDebug.LogWarning("Could not create Manager. Does the subdirectory " + managerPath + " exist?");
                Debug.LogException(e, this);
                pageNumber--;
            }
        }
예제 #22
0
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch
            {
                Debug.LogWarning("Could not create directory: " + Application.dataPath + "/" + managerPath);
                pageNumber--;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                references.settingsManager.movingTurning     = movingTurning;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager demoActionsManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (demoActionsManager != null)
                {
                    references.actionsManager.defaultClass = demoActionsManager.defaultClass;
                }

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;

                references.speechManager.ClearLanguages();

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                if (wizardMenu != WizardMenu.Blank)
                {
                    CursorManager demoCursorManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                    if (demoCursorManager != null)
                    {
                        foreach (CursorIcon demoIcon in demoCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(demoIcon);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot find Demo_CursorManager asset to copy from!");
                    }
                    references.cursorManager.allowMainCursor = true;

                    CursorIconBase pointerIcon = new CursorIconBase();
                    pointerIcon.Copy(demoCursorManager.pointerIcon);
                    references.cursorManager.pointerIcon = pointerIcon;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager demoMenuManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (demoMenuManager != null)
                    {
                        references.menuManager.drawOutlines = demoMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = demoMenuManager.drawInEditor;
                        references.menuManager.pauseTexture = demoMenuManager.pauseTexture;

                        if (wizardMenu == WizardMenu.DefaultUnityUI)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu demoMenu in demoMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(demoMenu);

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;

                                if (demoMenu.canvas)
                                {
                                    string oldCanvasPath = AssetDatabase.GetAssetPath(demoMenu.canvas);
                                    string newCanvasPath = "Assets/" + gameName + "/UI/" + demoMenu.canvas.name + ".prefab";
                                    if (AssetDatabase.CopyAsset(oldCanvasPath, newCanvasPath))
                                    {
                                        AssetDatabase.ImportAsset(newCanvasPath);
                                        newMenu.canvas = (Canvas)AssetDatabase.LoadAssetAtPath(newCanvasPath, typeof(Canvas));
                                    }
                                }
                            }

                            newMenu.hideFlags = HideFlags.HideInHierarchy;
                            references.menuManager.menus.Add(newMenu);
                            EditorUtility.SetDirty(references.menuManager);
                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                                AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                            }
                            AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot find Demo_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();
                references.sceneManager.InitialiseObjects();
                pageNumber = 0;
            }
            catch
            {
                Debug.LogWarning("Could not create Manager. Does the subdirectory " + Resource.managersDirectory + " exist?");
                pageNumber--;
            }
        }
예제 #23
0
        /**
         * <summary>A Constructor that sets all its values by copying another InvItem.</summary>
         * <param name = "assetItem">The InvItem to copy</param>
         */
        public InvItem(InvItem assetItem)
        {
            count       = assetItem.count;
            tex         = assetItem.tex;
            activeTex   = assetItem.activeTex;
            selectedTex = assetItem.selectedTex;

            //cursorIcon = assetItem.cursorIcon;
            cursorIcon = new CursorIcon();
            cursorIcon.Copy(assetItem.cursorIcon, true);

            carryOnStart           = assetItem.carryOnStart;
            carryOnStartNotDefault = assetItem.carryOnStartNotDefault;
            carryOnStartID         = assetItem.carryOnStartID;
            canCarryMultiple       = assetItem.canCarryMultiple;
            label     = assetItem.label;
            altLabel  = assetItem.altLabel;
            id        = assetItem.id;
            lineID    = assetItem.lineID;
            useIconID = assetItem.useIconID;

            binID = assetItem.binID;
            if (binID == -1 && KickStarter.inventoryManager != null && KickStarter.inventoryManager.bins != null && KickStarter.inventoryManager.bins.Count > 0)
            {
                // Place item in first available cateogry if undefined
                binID = KickStarter.inventoryManager.bins[0].id;
            }

            useSeparateSlots = assetItem.useSeparateSlots;
            selectSingle     = assetItem.selectSingle;
            isEditing        = false;
            recipeSlot       = -1;

            overrideUseSyntax = assetItem.overrideUseSyntax;
            hotspotPrefix1    = assetItem.hotspotPrefix1;
            hotspotPrefix2    = assetItem.hotspotPrefix2;

            useActionList              = assetItem.useActionList;
            lookActionList             = assetItem.lookActionList;
            interactions               = assetItem.interactions;
            combineActionList          = assetItem.combineActionList;
            unhandledActionList        = assetItem.unhandledActionList;
            unhandledCombineActionList = assetItem.unhandledCombineActionList;
            combineID    = assetItem.combineID;
            linkedPrefab = assetItem.linkedPrefab;

            canBeAnimated = DetermineCanBeAnimated();

            vars = assetItem.vars;
            if (Application.isPlaying)
            {
                for (int i = 0; i < vars.Count; i++)
                {
                    if (vars[i].type == VariableType.PopUp)
                    {
                        // Transfer ID of PopUps translation from global property to per-item
                        vars[i].popUpsLineID = KickStarter.inventoryManager.invVars[i].popUpsLineID;
                    }
                }
            }
        }
예제 #24
0
 /**
  * <summary>Sets the cursor to an icon defined in CursorManager.</summary>
  * <param name = "_icon">The cursor, within CursorManager's cursorIcons List, to select</param>
  */
 public void SetCursor(CursorIcon _icon)
 {
     selectedCursor = KickStarter.cursorManager.cursorIcons.IndexOf(_icon);
 }
예제 #25
0
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void RecalculateSize(MenuSource source)
        {
            if (uiButton == null)
            {
                if (AdvGame.GetReferences ().cursorManager)
                {
                    CursorIcon _icon = AdvGame.GetReferences ().cursorManager.GetCursorIconFromID (iconID);
                    if (_icon != null)
                    {
                        icon = _icon;
                        label = _icon.label;
                        icon.Reset ();
                    }
                }

                base.RecalculateSize (source);
            }
        }
예제 #26
0
 /**
  * <summary>The default Constructor.</summary>
  * <param name = "_icon">The icon, defined in CursorManager, associated with the interaction</param>
  */
 public InvInteraction(CursorIcon _icon)
 {
     icon       = _icon;
     actionList = null;
 }
예제 #27
0
        public override void RecalculateSize(MenuSource source)
        {
            if (AdvGame.GetReferences().cursorManager)
            {
                if (fixedIcon)
                {
                    CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                    if (_icon != null)
                    {
                        labels = new string[1];
                        icon   = _icon;
                        if (Application.isPlaying)
                        {
                            labels[0] = KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage(), _icon.GetTranslationType(0));
                        }
                        else
                        {
                            labels[0] = _icon.label;
                        }
                        icon.Reset();
                    }
                }
                else
                {
                    List <int> _iconIDs = new List <int>();
                    if (!KickStarter.settingsManager.autoHideInteractionIcons || !Application.isPlaying)
                    {
                        foreach (CursorIcon icon in KickStarter.cursorManager.cursorIcons)
                        {
                            _iconIDs.Add(icon.id);
                        }
                    }
                    else if (parentMenu != null)
                    {
                        if (parentMenu.TargetHotspot != null)
                        {
                            foreach (Button button in parentMenu.TargetHotspot.useButtons)
                            {
                                if (!button.isDisabled)
                                {
                                    _iconIDs.Add(button.iconID);
                                }
                            }
                        }
                        else if (parentMenu.TargetInvItem != null)
                        {
                            foreach (InvInteraction interaction in parentMenu.TargetInvItem.interactions)
                            {
                                _iconIDs.Add(interaction.icon.id);
                            }
                        }
                    }

                    iconIDs = _iconIDs.ToArray();

                    labels = new string[iconIDs.Length];
                    for (int i = 0; i < iconIDs.Length; i++)
                    {
                        CursorIcon _icon = KickStarter.cursorManager.GetCursorIconFromID(iconIDs[i]);
                        if (Application.isPlaying)
                        {
                            labels[i] = (_icon != null) ? KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage(), _icon.GetTranslationType(0)) : string.Empty;
                        }
                        else
                        {
                            labels[i] = (icon != null) ? _icon.label : string.Empty;
                        }
                    }

                    if (Application.isPlaying)
                    {
                        numSlots = iconIDs.Length;
                        if (numSlots > maxSlots)
                        {
                            numSlots = maxSlots;
                        }
                    }

                    LimitOffset(iconIDs.Length);
                }
            }

            base.RecalculateSize(source);
        }
 /**
  * <summary>The default Constructor.</summary>
  * <param name = "_icon">The icon, defined in CursorManager, associated with the interaction</param>
  */
 public InvInteraction(CursorIcon _icon)
 {
     icon = _icon;
     actionList = null;
 }
예제 #29
0
        /**
         * <summary>A Constructor that sets all its values by copying another InvItem.</summary>
         * <param name = "assetItem">The InvItem to copy</param>
         */
        public InvItem(InvItem assetItem)
        {
            count       = assetItem.count;
            tex         = assetItem.tex;
            activeTex   = assetItem.activeTex;
            selectedTex = assetItem.selectedTex;

            //cursorIcon = assetItem.cursorIcon;
            cursorIcon = new CursorIcon();
            cursorIcon.Copy(assetItem.cursorIcon, true);

            carryOnStart           = assetItem.carryOnStart;
            carryOnStartNotDefault = assetItem.carryOnStartNotDefault;
            carryOnStartID         = assetItem.carryOnStartID;
            carryOnStartIDs.Clear();
            foreach (int _id in assetItem.carryOnStartIDs)
            {
                carryOnStartIDs.Add(_id);
            }
            Upgrade();
            canCarryMultiple = assetItem.canCarryMultiple;
            label            = assetItem.label;
            altLabel         = assetItem.altLabel;
            id        = assetItem.id;
            lineID    = assetItem.lineID;
            useIconID = assetItem.useIconID;

            canBeLowerCase = assetItem.canBeLowerCase;

            binID = assetItem.binID;
            if (binID == -1 && KickStarter.inventoryManager && KickStarter.inventoryManager.bins != null && KickStarter.inventoryManager.bins.Count > 0)
            {
                // Place item in first available cateogry if undefined
                binID = KickStarter.inventoryManager.bins[0].id;
            }

            maxCount         = assetItem.maxCount;
            itemStackingMode = assetItem.itemStackingMode;

            overrideUseSyntax = assetItem.overrideUseSyntax;
            hotspotPrefix1    = assetItem.hotspotPrefix1;
            hotspotPrefix2    = assetItem.hotspotPrefix2;

            useActionList              = assetItem.useActionList;
            lookActionList             = assetItem.lookActionList;
            interactions               = assetItem.interactions;
            combineActionList          = assetItem.combineActionList;
            unhandledActionList        = assetItem.unhandledActionList;
            unhandledCombineActionList = assetItem.unhandledCombineActionList;
            combineID    = assetItem.combineID;
            linkedPrefab = assetItem.linkedPrefab;

            canBeAnimated = DetermineCanBeAnimated();

            vars.Clear();
            foreach (InvVar invVar in assetItem.vars)
            {
                vars.Add(new InvVar(invVar));
            }

            if (Application.isPlaying)
            {
                for (int i = 0; i < vars.Count; i++)
                {
                    if (vars[i].type == VariableType.PopUp)
                    {
                        // Transfer ID of PopUps translation from global property to per-item
                        vars[i].popUpsLineID = KickStarter.inventoryManager.invVars[i].popUpsLineID;
                    }
                }
            }
        }
예제 #30
0
 /**
  * Clears the Hotspot's internal 'use' icon, as used when the Hotspot is highlighted.
  */
 public void ResetMainIcon()
 {
     mainIcon = null;
 }
예제 #31
0
        public override void PreDisplay(int _slot, int languageNumber, bool isActive)
        {
            isDefaultIcon = false;

            if (fixedIcon)
            {
                if (Application.isPlaying && KickStarter.stateHandler.IsInGameplay() && KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    if (KickStarter.settingsManager.allowDefaultinteractions &&
                        KickStarter.playerInteraction.GetActiveHotspot() != null &&
                        KickStarter.playerInteraction.GetActiveHotspot().GetFirstUseIcon() == iconID)
                    {
                        isActive      = true;
                        isDefaultIcon = true;
                    }
                    else if (KickStarter.settingsManager.allowDefaultInventoryInteractions &&
                             KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple &&
                             KickStarter.settingsManager.CanSelectItems(false) &&
                             KickStarter.playerInteraction.GetActiveHotspot() == null &&
                             KickStarter.runtimeInventory.hoverItem != null &&
                             KickStarter.runtimeInventory.hoverItem.GetFirstStandardIcon() == iconID
                             )
                    {
                        isActive      = true;
                        isDefaultIcon = true;
                    }
                }

                if (uiButton != null)
                {
                    UpdateUISelectable(uiButton, uiSelectableHideStyle);

                    if (displayType != AC_DisplayType.IconOnly && uiText != null)
                    {
                        uiText.text = labels[0];
                    }
                    if (displayType == AC_DisplayType.IconOnly && uiImage != null && icon != null && icon.isAnimated)
                    {
                        uiImage.sprite = icon.GetAnimatedSprite(isActive);
                    }

                    if (KickStarter.settingsManager.SelectInteractionMethod() == SelectInteractions.CyclingMenuAndClickingHotspot &&
                        iconID == KickStarter.playerInteraction.GetActiveUseButtonIconID())
                    {
                        // Select through script, not by mouse-over
                        uiButton.Select();
                    }
                }
            }
            else
            {
                if (uiSlots != null && uiSlots.Length > _slot)
                {
                    LimitUISlotVisibility(uiSlots, numSlots, uiSelectableHideStyle);

                    CursorIcon cursorIcon = GetIconAtSlot(_slot);
                    if (cursorIcon != null)
                    {
                        if (displayType == AC_DisplayType.IconOnly || displayType == AC_DisplayType.IconAndText)
                        {
                            uiSlots[_slot].SetImageAsSprite(cursorIcon.GetAnimatedSprite(isActive));
                        }
                        if (displayType == AC_DisplayType.TextOnly || displayType == AC_DisplayType.IconAndText)
                        {
                            uiSlots[_slot].SetText(labels[_slot]);
                        }
                    }
                }
            }
        }
예제 #32
0
파일: InvItem.cs 프로젝트: mcbodge/eidolon
        /**
         * <summary>A Constructor that sets all its values by copying another InvItem.</summary>
         * <param name = "assetItem">The InvItem to copy</param>
         */
        public InvItem(InvItem assetItem)
        {
            count = assetItem.count;
            tex = assetItem.tex;
            activeTex = assetItem.activeTex;
            selectedTex = assetItem.selectedTex;
            cursorIcon = assetItem.cursorIcon;
            carryOnStart = assetItem.carryOnStart;
            carryOnStartNotDefault = assetItem.carryOnStartNotDefault;
            carryOnStartID = assetItem.carryOnStartID;
            canCarryMultiple = assetItem.canCarryMultiple;
            label = assetItem.label;
            altLabel = assetItem.altLabel;
            id = assetItem.id;
            lineID = assetItem.lineID;
            useIconID = assetItem.useIconID;
            binID = assetItem.binID;
            useSeparateSlots = assetItem.useSeparateSlots;
            isEditing = false;
            recipeSlot = -1;

            overrideUseSyntax = assetItem.overrideUseSyntax;
            hotspotPrefix1 = assetItem.hotspotPrefix1;
            hotspotPrefix2 = assetItem.hotspotPrefix2;

            useActionList = assetItem.useActionList;
            lookActionList = assetItem.lookActionList;
            interactions = assetItem.interactions;
            combineActionList = assetItem.combineActionList;
            unhandledActionList = assetItem.unhandledActionList;
            unhandledCombineActionList = assetItem.unhandledCombineActionList;
            combineID = assetItem.combineID;
            vars = assetItem.vars;

            canBeAnimated = DetermineCanBeAnimated ();
        }
예제 #33
0
        private void ExtractIcon(CursorIcon icon, bool onlySeekNew)
        {
            if (onlySeekNew && icon.lineID == -1)
            {
                // Assign a new ID on creation
                SpeechLine newLine;
                newLine = new SpeechLine (GetIDArray(), "", icon.label, languages.Count - 1, AC_TextType.CursorIcon);
                icon.lineID = newLine.lineID;
                lines.Add (newLine);
            }

            else if (!onlySeekNew && icon.lineID > -1)
            {
                // Already has an ID, so don't replace
                SpeechLine existingLine = new SpeechLine (icon.lineID, "", icon.label, languages.Count - 1, AC_TextType.CursorIcon);

                int lineID = SmartAddLine (existingLine);
                if (lineID >= 0) icon.lineID = lineID;
            }
        }
예제 #34
0
파일: InvItem.cs 프로젝트: mcbodge/eidolon
        /**
         * <summary>The default Constructor.</summary>
         * <param name = "idArray">An array of already-used ID numbers, so that a unique ID number can be assigned</param>
         */
        public InvItem(int[] idArray)
        {
            count = 0;
            tex = null;
            activeTex = null;
            selectedTex = null;
            cursorIcon = new CursorIcon ();
            id = 0;
            binID = -1;
            recipeSlot = -1;
            useSeparateSlots = false;
            carryOnStartNotDefault = false;
            vars = new List<InvVar>();
            canBeAnimated = false;

            interactions = new List<InvInteraction>();

            combineActionList = new List<ActionListAsset>();
            combineID = new List<int>();

            overrideUseSyntax = false;
            hotspotPrefix1 = new HotspotPrefix ("Use");
            hotspotPrefix2 = new HotspotPrefix ("on");

            // Update id based on array
            foreach (int _id in idArray)
            {
                if (id == _id)
                    id ++;
            }

            label = "Inventory item " + (id + 1).ToString ();
            altLabel = "";
        }
예제 #35
0
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch (System.Exception e)
            {
                ACDebug.LogError("Wizard aborted - Could not create directory: " + Application.dataPath + "/" + managerPath + ". Please make sure the Assets direcrory is writeable, and that the intended game name contains no special characters.");
                Debug.LogException(e, this);
                pageNumber--;
                return;
            }

            try
            {
                ShowProgress(0f);

                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                ShowProgress(0.1f);

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movingTurning     = movingTurning;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                ShowProgress(0.2f);

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (defaultActionsManager != null)
                {
                    references.actionsManager.defaultClass     = defaultActionsManager.defaultClass;
                    references.actionsManager.defaultClassName = defaultActionsManager.defaultClassName;
                }

                ShowProgress(0.3f);

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                ShowProgress(0.4f);

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                ShowProgress(0.5f);

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;
                references.speechManager.ClearLanguages();

                ShowProgress(0.6f);

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                ShowProgress(0.7f);

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                CursorManager defaultCursorManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (defaultCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon();
                        useIcon.Copy(defaultCursorManager.cursorIcons[0], false);
                        references.cursorManager.cursorIcons.Add(useIcon);
                        EditorUtility.SetDirty(references.cursorManager);
                    }
                }
                else
                {
                    if (defaultCursorManager != null)
                    {
                        foreach (CursorIcon defaultIcon in defaultCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(defaultIcon, false);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase();
                        pointerIcon.Copy(defaultCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_CursorManager asset to copy from!");
                    }

                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager defaultMenuManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (defaultMenuManager != null)
                    {
                                                #if UNITY_EDITOR
                        references.menuManager.drawOutlines = defaultMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = defaultMenuManager.drawInEditor;
                                                #endif
                        references.menuManager.pauseTexture = defaultMenuManager.pauseTexture;

                        if (wizardMenu != WizardMenu.Blank)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu defaultMenu in defaultMenuManager.menus)
                        {
                            float progress = (float)defaultMenuManager.menus.IndexOf(defaultMenu) / (float)defaultMenuManager.menus.Count;
                            ShowProgress((progress * 0.3f) + 0.7f);

                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(defaultMenu, true, true);
                            newMenu.Recalculate();

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;
                            }

                            if (defaultMenu.canvas)
                            {
                                string oldPath = AssetDatabase.GetAssetPath(defaultMenu.canvas.gameObject);
                                string newPath = "Assets/" + gameName + "/UI/" + defaultMenu.canvas.name + ".prefab";

                                if (AssetDatabase.CopyAsset(oldPath, newPath))
                                {
                                    AssetDatabase.ImportAsset(newPath);
                                    GameObject canvasObNewPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(newPath, typeof(GameObject));
                                    newMenu.canvas = canvasObNewPrefab.GetComponent <Canvas>();
                                }
                                else
                                {
                                    newMenu.canvas = null;
                                    ACDebug.LogWarning("Could not copy asset " + oldPath + " to " + newPath, defaultMenu.canvas.gameObject);
                                }
                                newMenu.rectTransform = null;
                            }

                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                if (newElement != null)
                                {
                                    AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                                    newElement.hideFlags = HideFlags.HideInHierarchy;
                                }
                                else
                                {
                                    ACDebug.LogWarning("Null element found in " + newMenu.title + " - the interface may not be set up correctly.");
                                }
                            }

                            if (newMenu != null)
                            {
                                AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                                newMenu.hideFlags = HideFlags.HideInHierarchy;

                                references.menuManager.menus.Add(newMenu);
                            }
                            else
                            {
                                ACDebug.LogWarning("Unable to create new Menu from original '" + defaultMenu.title + "'");
                            }
                        }

                        EditorUtility.SetDirty(references.menuManager);

                                                #if CAN_USE_TIMELINE
                        if (references.speechManager != null)
                        {
                            references.speechManager.previewMenuName = "Subtitles";
                            EditorUtility.SetDirty(references.speechManager);
                        }
                                                #endif
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_MenuManager asset to copy from!");
                    }
                }

                EditorUtility.ClearProgressBar();
                ManagerPackage newManagerPackage = CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();

                if (newManagerPackage == null || !newManagerPackage.IsFullyAssigned())
                {
                    EditorUtility.DisplayDialog("Wizard failed", "The New Game Wizard failed to generate a new 'Manager Package' file with all eight Managers assigned. Pleae verify that your Assets directory is writable and try again.", "OK");
                }
                else if (GameObject.FindObjectOfType <KickStarter>() == null)
                {
                    bool initScene = EditorUtility.DisplayDialog("Organise scene?", "Process complete.  Would you like to organise the scene objects to begin working?  This can be done at any time within the Scene Manager.", "Yes", "No");
                    if (initScene)
                    {
                        references.sceneManager.InitialiseObjects();
                    }
                }
            }
            catch (System.Exception e)
            {
                ACDebug.LogWarning("Could not create Manager. Does the subdirectory " + managerPath + " exist?");
                Debug.LogException(e, this);
                pageNumber--;
            }
        }
예제 #36
0
		public override void RecalculateSize ()
		{
			if (AdvGame.GetReferences ().cursorManager)
			{
				CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;
				CursorIcon _icon = cursorManager.GetCursorIconFromID (iconID);
				if (_icon != null)
				{
					icon = _icon;
					label = _icon.label;
					icon.Reset ();
				}
			}

			base.RecalculateSize ();
		}
		private void Finish ()
		{
			if (!references)
			{
				GetReferences ();
			}
			
			if (!references)
			{
				return;
			}

			string managerPath = gameName + "/Managers";
			try
			{
				System.IO.Directory.CreateDirectory (Application.dataPath + "/" + managerPath);
			}
			catch
			{
				Debug.LogWarning ("Could not create directory: " + Application.dataPath + "/" + managerPath);
				pageNumber --;
				return;
			}

			try
			{
				ScriptableObject t = CustomAssetUtility.CreateAsset<SceneManager> ("SceneManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
				references.sceneManager = (SceneManager) t;

				t = CustomAssetUtility.CreateAsset<SettingsManager> ("SettingsManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
				references.settingsManager = (SettingsManager) t;

				references.settingsManager.saveFileName = gameName;
				references.settingsManager.cameraPerspective = cameraPerspective;
				references.settingsManager.movementMethod = movementMethod;
				references.settingsManager.inputMethod = inputMethod;
				references.settingsManager.interactionMethod = interactionMethod;
				references.settingsManager.hotspotDetection = hotspotDetection;
				references.settingsManager.movingTurning = movingTurning;

				t = CustomAssetUtility.CreateAsset<ActionsManager> ("ActionsManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
				references.actionsManager = (ActionsManager) t;
				references.actionsManager.RefreshList ();
				references.actionsManager.SetEnabled ();

				t = CustomAssetUtility.CreateAsset<VariablesManager> ("VariablesManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
				references.variablesManager = (VariablesManager) t;

				t = CustomAssetUtility.CreateAsset<InventoryManager> ("InventoryManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
				references.inventoryManager = (InventoryManager) t;

				t = CustomAssetUtility.CreateAsset<SpeechManager> ("SpeechManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
				references.speechManager = (SpeechManager) t;

				t = CustomAssetUtility.CreateAsset<CursorManager> ("CursorManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
				references.cursorManager = (CursorManager) t;

				t = CustomAssetUtility.CreateAsset<MenuManager> ("MenuManager", managerPath);
				AssetDatabase.RenameAsset ("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
				references.menuManager = (MenuManager) t;

				if (!createNewMenu)
				{
					CursorManager demoCursorManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_CursorManager.asset", typeof(CursorManager)) as CursorManager;
					foreach (CursorIcon demoIcon in demoCursorManager.cursorIcons)
					{
						CursorIcon newIcon = new CursorIcon ();
						newIcon.Copy (demoIcon);
						references.cursorManager.cursorIcons.Add (newIcon);
					}

					references.cursorManager.allowMainCursor = true;

					CursorIconBase pointerIcon = new CursorIconBase ();
					pointerIcon.Copy (demoCursorManager.pointerIcon);
					references.cursorManager.pointerIcon = pointerIcon;
					EditorUtility.SetDirty (references.cursorManager);

					MenuManager demoMenuManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_MenuManager.asset", typeof(MenuManager)) as MenuManager;
					references.menuManager.drawOutlines = demoMenuManager.drawOutlines;
					references.menuManager.drawInEditor = demoMenuManager.drawInEditor;
					references.menuManager.pauseTexture = demoMenuManager.pauseTexture;
					foreach (Menu demoMenu in demoMenuManager.menus)
					{
						Menu newMenu = ScriptableObject.CreateInstance <Menu>();
						newMenu.Copy (demoMenu);
						newMenu.hideFlags = HideFlags.HideInHierarchy;
						references.menuManager.menus.Add (newMenu);
						EditorUtility.SetDirty (references.menuManager);
						foreach (MenuElement newElement in newMenu.elements)
						{
							newElement.hideFlags = HideFlags.HideInHierarchy;
							AssetDatabase.AddObjectToAsset (newElement, references.menuManager);
						}
						AssetDatabase.AddObjectToAsset (newMenu, references.menuManager);
					}
				}

				CreateManagerPackage (gameName);

				AssetDatabase.SaveAssets ();
				references.sceneManager.InitialiseObjects ();
			}
			catch
			{
				Debug.LogWarning ("Could not create Manager. Does the subdirectory " + Resource.managersDirectory + " exist?");
				pageNumber --;
			}
		}
        private void Finish()
        {
            if (!references)
            {
                GetReferences ();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";
            try
            {
                System.IO.Directory.CreateDirectory (Application.dataPath + "/" + managerPath);
            }
            catch
            {
                ACDebug.LogWarning ("Could not create directory: " + Application.dataPath + "/" + managerPath);
                pageNumber --;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset<SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager) t;

                t = CustomAssetUtility.CreateAsset<SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager) t;

                references.settingsManager.saveFileName = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movementMethod = movementMethod;
                references.settingsManager.inputMethod = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection = hotspotDetection;
                references.settingsManager.movingTurning = movingTurning;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset<ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager) t;
                AdventureCreator.RefreshActions ();
                ActionsManager demoActionsManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (demoActionsManager != null)
                {
                    references.actionsManager.defaultClass = demoActionsManager.defaultClass;
                }

                t = CustomAssetUtility.CreateAsset<VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager) t;

                t = CustomAssetUtility.CreateAsset<InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager) t;

                t = CustomAssetUtility.CreateAsset<SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager) t;

                references.speechManager.ClearLanguages ();

                t = CustomAssetUtility.CreateAsset<CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager) t;

                t = CustomAssetUtility.CreateAsset<MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset ("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager) t;

                CursorManager demoCursorManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (demoCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon ();
                        useIcon.Copy (demoCursorManager.cursorIcons[0]);
                        references.cursorManager.cursorIcons.Add (useIcon);
                        EditorUtility.SetDirty (references.cursorManager);
                    }
                }
                else
                {
                    if (demoCursorManager != null)
                    {
                        foreach (CursorIcon demoIcon in demoCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon ();
                            newIcon.Copy (demoIcon);
                            references.cursorManager.cursorIcons.Add (newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase ();
                        pointerIcon.Copy (demoCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning ("Cannot find Demo_CursorManager asset to copy from!");
                    }

                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty (references.cursorManager);

                    MenuManager demoMenuManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (demoMenuManager != null)
                    {
                        #if UNITY_EDITOR
                        references.menuManager.drawOutlines = demoMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = demoMenuManager.drawInEditor;
                        #endif
                        references.menuManager.pauseTexture = demoMenuManager.pauseTexture;

                        if (wizardMenu == WizardMenu.DefaultUnityUI)
                        {
                            System.IO.Directory.CreateDirectory (Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu demoMenu in demoMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy (demoMenu);

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;

                                if (demoMenu.canvas)
                                {
                                    string oldCanvasPath = AssetDatabase.GetAssetPath (demoMenu.canvas);
                                    string newCanvasPath = "Assets/" + gameName + "/UI/" + demoMenu.canvas.name + ".prefab";
                                    if (AssetDatabase.CopyAsset (oldCanvasPath, newCanvasPath))
                                    {
                                        AssetDatabase.ImportAsset (newCanvasPath);
                                        newMenu.canvas = (Canvas) AssetDatabase.LoadAssetAtPath (newCanvasPath, typeof (Canvas));
                                    }
                                }
                            }

                            newMenu.hideFlags = HideFlags.HideInHierarchy;
                            references.menuManager.menus.Add (newMenu);
                            EditorUtility.SetDirty (references.menuManager);
                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                                AssetDatabase.AddObjectToAsset (newElement, references.menuManager);
                            }
                            AssetDatabase.AddObjectToAsset (newMenu, references.menuManager);
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning ("Cannot find Demo_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage (gameName);

                AssetDatabase.SaveAssets ();
                references.sceneManager.InitialiseObjects ();
                pageNumber = 0;
            }
            catch
            {
                ACDebug.LogWarning ("Could not create Manager. Does the subdirectory " + Resource.managersDirectory + " exist?");
                pageNumber --;
            }
        }
예제 #39
0
        public override void Display(GUIStyle _style, int _slot, float zoom, bool isActive)
        {
            base.Display(_style, _slot, zoom, isActive);

            _style.wordWrap  = true;
            _style.alignment = anchor;
            if (zoom < 1f)
            {
                _style.fontSize = (int)((float)_style.fontSize * zoom);
            }

            if (fixedIcon)
            {
                if (displayType != AC_DisplayType.IconOnly)
                {
                    if (textEffects != TextEffects.None)
                    {
                        AdvGame.DrawTextEffect(ZoomRect(relativeRect, zoom), labels[0], _style, Color.black, _style.normal.textColor, outlineSize, textEffects);
                    }
                    else
                    {
                        GUI.Label(ZoomRect(relativeRect, zoom), labels[0], _style);
                    }
                }
                else
                {
                    GUI.Label(ZoomRect(relativeRect, zoom), string.Empty, _style);
                }

                if (overrideTexture)
                {
                    if (iconID >= 0 && KickStarter.playerCursor.GetSelectedCursorID() == iconID && activeTexture != null)
                    {
                        GUI.DrawTexture(ZoomRect(relativeRect, zoom), activeTexture, ScaleMode.StretchToFill, true, 0f);
                    }
                }
                else
                {
                    if (displayType != AC_DisplayType.TextOnly && icon != null)
                    {
                        icon.DrawAsInteraction(ZoomRect(relativeRect, zoom), isActive);
                    }
                }
            }
            else
            {
                if (displayType != AC_DisplayType.IconOnly)
                {
                    if (textEffects != TextEffects.None)
                    {
                        AdvGame.DrawTextEffect(ZoomRect(GetSlotRectRelative(_slot), zoom), labels[_slot], _style, Color.black, _style.normal.textColor, outlineSize, textEffects);
                    }
                    else
                    {
                        GUI.Label(ZoomRect(GetSlotRectRelative(_slot), zoom), labels[_slot], _style);
                    }
                }
                else
                {
                    GUI.Label(ZoomRect(GetSlotRectRelative(_slot), zoom), string.Empty, _style);
                }

                CursorIcon _icon = GetIconAtSlot(_slot);
                if (displayType != AC_DisplayType.TextOnly && _icon != null)
                {
                    _icon.DrawAsInteraction(ZoomRect(GetSlotRectRelative(_slot), zoom), isActive);
                }
            }
        }