示例#1
0
        /// <summary>
        /// We save a conversation is complete by saving the starting node id.
        /// </summary>
        /// <param name="conv"></param>
        private void SaveConversationComplete(Conversation conv)
        {
            ConversationNode startNode = conv.nodeMap[conv.startNodeTitle];

            // Flag that whole conversation tree as complete
            PlayerAccountManager.GetInstance().GetPlayer().SetValue <int>(startNode.treeID, 1);

            // Auto save the player
            PlayerAccountManager pm = PlayerAccountManager.GetInstance();

            pm.AutoSavePlayerToCurrentSlot();
        }
示例#2
0
        private void ApplyParamModifiers(ConversationNode node)
        {
            if (node.paramMods == null || node.paramMods.Count < 1)
            {
                return;
            }

            PlayerAccountManager pm = PlayerAccountManager.GetInstance();
            Player player           = pm.GetPlayer();

            for (int i = 0, count = node.paramMods.Count; i < count; i++)
            {
                ConversationParamModifier mod = node.paramMods[i];

                // If it's a music parameter then play the transition
                if (ParameterModifierUtils.IsMusicParameter(mod.paramName))
                {
                    if (mod.paramName == MusicController.DIALOG_PARAM_MUSIC_FADEIN)
                    {
                        MusicController.GetInstance().TransitionToNewSong(mod.strValue);
                    }

                    if (mod.paramName == MusicController.DIALOG_PARAM_MUSIC_FADEOUT)
                    {
                        MusicController.GetInstance().FadeOutCurrentSong();
                    }

                    continue;
                }

                if (ParameterModifierUtils.IsScreenParameter(mod.paramName))
                {
                    if (mod.paramName == PMOD_SCREEN_QUEUE)
                    {
                        GameObject MainMenu = GameObject.Find(GameConstants.UI_MAIN_MENU);
                        GameObject screen   = UIFactory.CreateScreen(mod.strValue, MainMenu);
                        ScreenQueueManager.GetInstance().QueueScreen(screen);
                    }
                    continue;
                }

                if (ParameterModifierUtils.IsMapParameter(mod.paramName))
                {
                    // Preload a map
                    if (mod.paramName == PMOD_MAP_PRELOAD)
                    {
                        MapController.GetInstance().LoadMapByUID(mod.strValue);
                    }

                    if (mod.paramName == PMOD_MAP_SHOW)
                    {
                        MapController.GetInstance().ShowMap();
                    }

                    continue;
                }

                // Set the string or integer to the given value.
                if (mod.action == ConversationParamModifier.ModifierActionType.Set)
                {
                    if (mod.type == ConversationParamModifier.ModifierType.Integer)
                    {
                        player.SetValue <int>(mod.paramName, mod.intValue);
                    }
                    else
                    {
                        player.SetValue <string>(mod.paramName, mod.strValue);
                    }
                    continue;
                }

                if (mod.action == ConversationParamModifier.ModifierActionType.Increment)
                {
                    player.IncrementValue(mod.paramName, mod.intValue);
                    continue;
                }

                if (mod.action == ConversationParamModifier.ModifierActionType.Decrement)
                {
                    player.IncrementValue(mod.paramName, -mod.intValue);
                    continue;
                }
            }

            // Save the player progress at this point.
            pm.AutoSavePlayerToCurrentSlot();
        }