Ejemplo n.º 1
0
    public void SayDialogFor(int playerID, CharacterDefinition character, DialogContext context, string conditional = "")
    {
        CharacterDialogDefinition dialogDefinition = character.dialogDefinition;
        List <CharacterDialog>    allDialog        = dialogDefinition.dialogDictionary[context];
        List <CharacterDialog>    relevantDialog   = new List <CharacterDialog>();

        for (int i = 0; i < allDialog.Count; i++)
        {
            if (allDialog[i].useDialogConditional && allDialog[i].dialogConditional.ToLower() == conditional.ToLower())
            {
                relevantDialog.Add(allDialog[i]);
            }
            else if (!allDialog[i].useDialogConditional)
            {
                relevantDialog.Add(allDialog[i]);
            }
        }

        if (relevantDialog.Count > 0)
        {
            CharacterDialog nextDialog = relevantDialog[Random.Range(0, relevantDialog.Count - 1)];
            if (nextDialog.priority >= currentPriority)
            {
                if (currentChain != null)
                {
                    CoroutineServer.StopCoroutine(currentChain);
                }
                currentPriority = nextDialog.priority;
                currentChain    = CoroutineServer.StartCoroutine(StartDialogChain(playerID, nextDialog));
            }
        }
    }
Ejemplo n.º 2
0
    void AddCharacterDialog(CharacterDialog characterDialog)
    {
        if (characterDialog == null)
        {
            return;
        }

        foreach (var dialog in characterDialog.dialogSets)
        {
            AddDialog(dialog);
        }
    }
Ejemplo n.º 3
0
    private IEnumerator StartDialogChain(int player, CharacterDialog nextDialog)
    {
        while (nextDialog != null)
        {
            string dialog = nextDialog.dialogText;
            float  delay  = displayers[player].SayQuip(dialog);
            yield return(new WaitForSeconds(delay));

            nextDialog = nextDialog.chainedDialog;
        }
        currentChain    = null;
        currentPriority = -1;
    }
Ejemplo n.º 4
0
 public ItemWithCharacterInput(string subject, string dialogTitle, string startText, Action <string> OnChanged, bool hideInput, bool disableEnter, bool disableNumberAndSymbols)
 {
     this.subject   = subject;
     this.Text      = startText;
     this.hide      = hideInput;
     dialog         = new Dialogs.CharacterDialog(dialogTitle, disableNumberAndSymbols, disableEnter);
     dialog.OnExit += delegate
     {
         string newText = dialog.GetUserInput();
         if (newText != null)
         {
             Text = newText;
         }
         if (OnChanged != null && newText != null)
         {
             OnChanged(Text);
         }
         show = false;
         Parent.RemoveFocus(this);
     };
 }
Ejemplo n.º 5
0
    static CharacterDialog CreateDialog(int depth, Transform parent, CharacterDialog firstDialog)
    {
        GameObject dialogObject = new GameObject("Character Dialog", typeof(CharacterDialog));
        dialogObject.transform.parent = parent;

        var dialog = dialogObject.GetComponent<CharacterDialog>();

        if (depth == 1)
        {
            firstDialog = dialog;
        }

        if (depth < 3)
        {
            dialog.nextDialog = CreateDialog(depth + 1, dialogObject.transform, firstDialog);
        }
        else
        {
            //dialog.nextDialog = firstDialog;
        }
        return dialog;
    }
Ejemplo n.º 6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Scene = null;
                User = null;

                MoveTime = 0;
                AttackTime = 0;
                NextRunTime = 0;
                CanMove = false;
                CanRun = false;

                MapControl = null;
                MainDialog = null;
                ChatDialog = null;
                ChatControl = null;
                InventoryDialog = null;
                CharacterDialog = null;
                StorageDialog = null;
                BeltDialog = null;
                MiniMapDialog = null;
                InspectDialog = null;
                OptionDialog = null;
                MenuDialog = null;
                NPCDialog = null;
                QuestDetailDialog = null;
                QuestListDialog = null;
                QuestLogDialog = null;
                QuestTrackingDialog = null;
                GameShopDialog = null;
                MentorDialog = null;

                RelationshipDialog = null;
                CharacterDuraPanel = null;
                DuraStatusPanel = null;

                HoverItem = null;
                SelectedCell = null;
                PickedUpGold = false;

                UseItemTime = 0;
                PickUpTime = 0;
                InspectTime = 0;

                DisposeItemLabel();

                AMode = 0;
                PMode = 0;
                Lights = 0;

                NPCTime = 0;
                NPCID = 0;
                DefaultNPCID = 0;

                for (int i = 0; i < OutputLines.Length; i++)
                    if (OutputLines[i] != null && OutputLines[i].IsDisposed)
                        OutputLines[i].Dispose();

                OutputMessages.Clear();
                OutputMessages = null;
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 7
0
        public GameScene()
        {
            MapControl.AutoRun = false;
            MapControl.AutoHit = false;
            Slaying = false;
            Thrusting = false;
            HalfMoon = false;
            CrossHalfMoon = false;
            DoubleSlash = false;
            TwinDrakeBlade = false;
            FlamingSword = false;

            GroupDialog.GroupList.Clear();

            Scene = this;
            BackColour = Color.Transparent;
            MoveTime = CMain.Time;

            KeyDown += GameScene_KeyDown;

            MainDialog = new MainDialog { Parent = this };
            ChatDialog = new ChatDialog { Parent = this };
            ChatControl = new ChatControlBar { Parent = this };
            InventoryDialog = new InventoryDialog { Parent = this };
            CharacterDialog = new CharacterDialog { Parent = this, Visible = false };
            BeltDialog = new BeltDialog { Parent = this };
            StorageDialog = new StorageDialog { Parent = this, Visible = false };
            MiniMapDialog = new MiniMapDialog { Parent = this };
            InspectDialog = new InspectDialog { Parent = this, Visible = false };
            OptionDialog = new OptionDialog { Parent = this, Visible = false };
            MenuDialog = new MenuDialog { Parent = this, Visible = false };
            NPCDialog = new NPCDialog { Parent = this, Visible = false };
            NPCGoodsDialog = new NPCGoodsDialog { Parent = this, Visible = false };
            NPCDropDialog = new NPCDropDialog { Parent = this, Visible = false };
            NPCAwakeDialog = new NPCAwakeDialog { Parent = this, Visible = false };

            HelpDialog = new HelpDialog { Parent = this, Visible = false };
            
            MountDialog = new MountDialog { Parent = this, Visible = false };
            FishingDialog = new FishingDialog { Parent = this, Visible = false };
            FishingStatusDialog = new FishingStatusDialog { Parent = this, Visible = false };
            
            GroupDialog = new GroupDialog { Parent = this, Visible = false };
            GuildDialog = new GuildDialog { Parent = this, Visible = false };
            GuildBuffDialog = new GuildBuffDialog { Parent = this, Visible = false };
            BigMapDialog = new BigMapDialog { Parent = this, Visible = false };
            TrustMerchantDialog = new TrustMerchantDialog { Parent = this, Visible = false };
            CharacterDuraPanel = new CharacterDuraPanel { Parent = this, Visible = false };
            DuraStatusPanel = new DuraStatusDialog { Parent = this, Visible = true };
            TradeDialog = new TradeDialog { Parent = this, Visible = false };
            GuestTradeDialog = new GuestTradeDialog { Parent = this, Visible = false };

            SkillBarDialog = new SkillBarDialog { Parent = this, Visible = false };
            ChatOptionDialog = new ChatOptionDialog { Parent = this, Visible = false };
            ChatNoticeDialog = new ChatNoticeDialog { Parent = this, Visible = false };

            QuestListDialog = new QuestListDialog { Parent = this, Visible = false };
            QuestDetailDialog = new QuestDetailDialog {Parent = this, Visible = false};
            QuestTrackingDialog = new QuestTrackingDialog { Parent = this, Visible = false };
            QuestLogDialog = new QuestDiaryDialog {Parent = this, Visible = false};

            RankingDialog = new RankingDialog { Parent = this, Visible = false };

            MailListDialog = new MailListDialog { Parent = this, Visible = false };
            MailComposeLetterDialog = new MailComposeLetterDialog { Parent = this, Visible = false };
            MailComposeParcelDialog = new MailComposeParcelDialog { Parent = this, Visible = false };
            MailReadLetterDialog = new MailReadLetterDialog { Parent = this, Visible = false };
            MailReadParcelDialog = new MailReadParcelDialog { Parent = this, Visible = false };

            IntelligentCreatureDialog = new IntelligentCreatureDialog { Parent = this, Visible = false };//IntelligentCreature
            IntelligentCreatureOptionsDialog = new IntelligentCreatureOptionsDialog { Parent = this, Visible = false };//IntelligentCreature
            IntelligentCreatureOptionsGradeDialog = new IntelligentCreatureOptionsGradeDialog { Parent = this, Visible = false };//IntelligentCreature

            RefineDialog = new RefineDialog { Parent = this, Visible = false };
            RelationshipDialog = new RelationshipDialog { Parent = this, Visible = false };
            FriendDialog = new FriendDialog { Parent = this, Visible = false };
            MemoDialog = new MemoDialog { Parent = this, Visible = false };
            MentorDialog = new MentorDialog { Parent = this, Visible = false };
            GameShopDialog = new GameShopDialog { Parent = this, Visible = false };

            //not added yet
            KeyboardLayoutDialog = new KeyboardLayoutDialog { Parent = this, Visible = false };
            

            

            for (int i = 0; i < OutputLines.Length; i++)
                OutputLines[i] = new MirLabel
                {
                    AutoSize = true,
                    BackColour = Color.Transparent,
                    Font = new Font(Settings.FontName, 10F),
                    ForeColour = Color.LimeGreen,
                    Location = new Point(20, 25 + i * 13),
                    OutLine = true,
                };
        }