dialog() public method

public dialog ( Int32 targetID, UInt32 dialogID ) : void
targetID System.Int32
dialogID System.UInt32
return void
Example #1
0
    public void dialog_setContent(Int32 talkerId, List <object> dialogIds, List <object> dialogsTitles, string title, string body, string sayname)
    {
        KBEngine.Entity entity = KBEngineApp.app.player();
        KBEngine.Avatar avatar = null;
        if (entity != null && entity.className == "Avatar")
        {
            avatar = (KBEngine.Avatar)entity;
        }

        List <string>      titles  = new List <string>();
        List <UnityAction> actions = new List <UnityAction>();

        for (int i = 0; i < dialogsTitles.Count; i++)
        {
            titles.Add((string)dialogsTitles[i]);
            UInt32 dialogId = (UInt32)dialogIds[i];
            actions.Add(() => avatar.dialog(talkerId, dialogId));
        }
        if (titles.Count > 0)
        {
            MenuBox.Show
            (
                titles,
                actions,
                sayname + ": " + body
            );
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        KBEngine.Entity entity = KBEngineApp.app.player();
        KBEngine.Avatar avatar = null;
        if (entity != null && entity.className == "Avatar")
        {
            avatar = (KBEngine.Avatar)entity;
        }

        if (avatar != null)
        {
            text_pos.text = avatar.position.x.ToString("#.0") + "," + avatar.position.z.ToString("#.0");

            foreach (Skill sk in SkillBox.inst.skills)
            {
                sk.updateTimer(Time.deltaTime);//更新技能的冷却时间
            }
        }
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100.0f, 1 << LayerMask.NameToLayer("CanAttack")))
            {
                UI_Target ui_target = World.instance.getUITarget();
                ui_target.GE_target = hit.collider.GetComponent <GameEntity>();
                ui_target.UpdateTargetUI();

                string name = Utility.getPreString(ui_target.GE_target.name);
                if (name == "NPC" && !MenuBox.hasMenu())
                {
                    Int32 id   = Utility.getPostInt(ui_target.GE_target.name);
                    NPC   _npc = (NPC)KBEngineApp.app.findEntity(id);

                    if (_npc != null)
                    {
                        UInt32 dialogID = _npc.dialogID;
                        avatar.dialog(id, dialogID);
                    }
                }
            }
        }
        //更新消耗品计时器
        ConsumeLimitCD.instance.Update(Time.deltaTime);
    }