GithubHelp home page GithubHelp logo

chatting-system's Introduction

Chatting System

目前完成了基础的对话功能,功能如下

  • 对话
  • 选择
  • 滚动对话
  • 自动播放对话
  • 每条对话添加语音

数据储存

使用ScriptableObject继承的DialogueSO文件来储存一段对话内容:

滚动播放设置

public bool IsJump; //true开始滚动对话,字符一个一个的跳动
public float JumpTIme = 0; //每个字符出现的时间,单位为秒

自动播放设置

public bool IsAuto = false; //true开启自动对话
public float AutoWaitTime; //每句话滚动显示完成后,停顿时间,再跳转到下一对话

背景音乐设置

public bool IsPlayBackroundAudio; //true开启背景音乐
public AudioClip BackgroundAudioClip; //背景音乐的音频

对话列表

因为会出现选项,对话使用数组储存的伪链表结构进行储存。

public List<Dialogue> DialogueList;


[Serializable]
public class Dialogue
{
	public bool IsElect = false; //本条对话是选项还是对话
    public MessageItem MessageItem; //对话的存储
    public List<ElectItem> ElectItems; //选项的储存

    public AudioItem AudioItem; //可添加音频,例如角色语音
}

[Serializable]
public class MessageItem
{
	public string CharacterName;
    public string Message;
    public int MessageNext;
}

[Serializable]
public class ElectItem
{
	public string ElectMessage;
    public int NextDialogue;
}

[Serializable]
public class AudioItem
{
	public bool IsPlayAudio;
    public AudioClip Audio;
}

对话的使用

设置好对话文件后,将其添加到DialogueMgrDialogue So List中,然后调用DialogueMgrShowDialogue(number)函数即可,number值为在上述列表Dialogue So List的序号。

chatting-system's People

Contributors

banned2054 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.