MMORPG大型游戏设计与开发(客户端架构 part2 of vgui)
这一节我将讲解vgui的基础系统部分,也是该库提供给外部使用的一些重要接口。作为UI部分比较重要的部分,该节有着至关重要的部分,如果没有看到上一节内容,请留意下面的连接。我们现在可以猜想一下在客户端UI部分,要设计到哪些东西呢?首先UI的大部分操作便是窗口的显示,那么窗口中又有哪些元素呢?链接、文字……
CODE
/**
* PAP Engine ( -- )
* $Id system.h
* @link -- for the canonical source repository
* @copyright Copyright (c) 2013-2014 viticm( viticm@126.com )
* @license
* @user viticm<viticm@126.com/viticm.ti@gmail.com>
* @date 2014-3-26 11:26:48
* @uses vgui base system
*/
#ifndef VGUI_BASE_SYSTEM_H_
#define VGUI_BASE_SYSTEM_H_ #include <OgreRoot.h>
#include <imm.h>
#include "CEGUIString.h"
#include "vengine/ui/system.h"
#include "vgui/config.h" /** ogre and cegui { **/ namespace Ogre {
class Root;
}; //namespace Ogre namespace CEGUI {
class System;
class OgreCEGUIRenderer;
class FalagardActionButton;
class EventArgs;
class Window;
}; //namespace CEGUI namespace vgui_script {
class Base;
}; //namespace vgui_script /** }ogre and cegui **/ namespace vgui_window {
class Manager;
}; //namespace vgui_base namespace vgui_icon {
class Manager;
}; //namespace vgui_icon namespace vgui_string {
class System;
}; //namespace vgui_string namespace vgui_creature { namespace head_board {
class System;
}; //namespace head_board }; //namespace vgui_creature namespace vgui_base { class System : public vengine_ui::System { VENGINE_KERNEL_DECLARE_DYNAMIC(vgui_base_System); public:
System();
virtual ~System();
static System* getself(); public: //implement from abstract class
virtual void on_windowsize_change(uint32_t message,
WPARAM wparam,
LPARAM lparam); //窗口大小改变事件
virtual void injectinput(); //如果事件结果为true则获取了输入
virtual bool messageprocess(HWND hwnd,
uint32_t message,
WPARAM wparam,
LPARAM lparam); //文字输入消息
virtual bool is_mousehover(); //鼠标是否在UI上空
//鼠标是否在聊天板上空
virtual bool is_mousehover_chatboard(int64_t x, int64_t y);
//获得聊天信息里的超链接信息
virtual STRING get_chatboard_hyplink_content(int64_t x, int64_t y);
//创建一个新的角色信息板
virtual vengine_ui::CreatureHeadBoard* create_creature_headboard();
//添加一个新的被击中信息框
virtual void add_behit_board(bool _double,
const char* info,
float startx,
float starty,
uint8_t type,
uint8_t movetype);
virtual bool is_windowshow(const char* name,
const char* childname = NULL);
virtual bool close_allwindow();
//通知UI创建一组UI显示模型
virtual void fakeobject_show(const char* windowname, const char* name);
//知UI销毁一组UI显示模型
virtual void fakeobject_destroy(const char* windowname,
const char* name); //debugs
public:
virtual void debug_push_chatstring(const char* name,
const char* message);
virtual void debug_save_fonttexture(); public:
virtual void change_dragflag(bool flag);
virtual bool is_dragend(); public:
//逻辑层添加系统通知信息
virtual STRING parsestring_varparam(const char* id, ...);
virtual void parsestring_nocolor(const STRING& in,
STRING& out,
bool control = false);
virtual STRING parsestring_nocolor_varparam(const char* id, ...);
virtual STRING parsestring_no_varparam(const char* id);
virtual STRING parsestring_nocolor_no_varparam(const char* id); //聊天模板字串的取得
virtual STRING get_talktemplate(const STRING& key, uint16_t index);
virtual STRING modify_chattemplate(const STRING& temp,
const STRING& talker,
const STRING& target);
virtual STRING get_talkrand_helpmessage(); //聊天随机提示消息
//查看当前获取输入的EditBox
virtual bool is_IME_editbox_active(const char* windowname);
virtual int32_t get_current_IMEstate(); //获取当前输入法状态
virtual STRING get_IME_editbox_string(const char* name); //获得输入内容 //传入一个物品信息
virtual bool inject_iteminfo(
vengine_game::ItemTransferSystem::element_t* element); virtual void on_pushescape();
virtual bool is_paopao_active();
virtual uint32_t lumination_ogrecolor(uint32_t ogrecolor,
int32_t lumination);
virtual int32_t ogrecolor_lumination(uint32_t ogrecolor); //过滤字符串中的非法敏感字符
virtual bool check_stringfilter(
const STRING& in,
const vengine_ui::filtertype_enum type = vengine_ui::kFilterTypeNone);
virtual bool check_stringcode(const STRING& in, STRING& out);
//完全匹配过滤
virtual bool check_string_fullcompare(const STRING& in,
const STRING& filtertype = "all",
bool use_alltable = true);
virtual STRING get_debugstring(); //取当前的鼠标下面的窗口
virtual void openwindow(const STRING& name);
virtual void closewindow(const STRING& name);
virtual void togglewindow(const STRING& name); virtual bool has_inputfocus(); //加聊天信息(提高显示聊天信息的效率)
virtual bool add_chathistory_message(int32_t id,
const char* windowname,
const char* message,
int32_t type = -,
uint32_t disappeartime = );
virtual void replacestring_usefilter(
const STRING& in,
STRING& out,
vengine_ui::filtertype_enum filtertype = vengine_ui::kFilterTypeChat);
virtual STRING check_stringvalid(const char* string);
virtual bool reload_windowscript(const STRING& windowname);
virtual void uirender_toggleshow(); public:
virtual void init(void*);
virtual void release();
virtual void tick(); public:
virtual bool is_ctrlinfo_enable();
virtual void set_ctrlinfo_enable(bool enable); public: //action buttons
vgui_icon::Manager* get_iconmanager();
//捕获拖动开始
bool handle_action_dragdrop_started(const CEGUI::EventArgs& event);
//鼠标进入,显示super tooltip
bool handle_actionbutton_mouseenter(const CEGUI::EventArgs& event);
//鼠标离开,隐藏super tooltip
bool handle_actionbutton_mouseleave(const CEGUI::EventArgs& event);
//父窗口关闭
bool handle_actionbutton_parenthidden(const CEGUI::EventArgs& event);
//mesh window开始显示
bool handle_meshwindow_shown(const CEGUI::EventArgs& event);
//mesh window隐藏
bool handle_meshwindow_hiden(const CEGUI::EventArgs& event); public: //超链接
bool handle_hyperlink_active(const CEGUI::EventArgs &event);
bool handle_hyperlink_leftactive(const CEGUI::EventArgs &event);
bool handle_hyperlink_rightactive(const CEGUI::EventArgs &event);
bool handle_hyperlink_inactive(const CEGUI::EventArgs &event); public:
//删除itemelement的通知相关
bool handle_elementdelete(const CEGUI::EventArgs &event);
//chat history 点击infoelement的通知
bool handle_chathistory_infoelement_click(const CEGUI::EventArgs& event);
//chat history 鼠标在infoelement的通知
bool handle_chathistory_infoelement_movein(const CEGUI::EventArgs& event);
bool handle_chathistory_infoelement_moveout(const CEGUI::EventArgs& event);
//click sound 对应按钮点击后播放声音
bool handle_pushbutton_clicksound(const CEGUI::EventArgs& event); protected:
Ogre::Root* ogreroot_;
CEGUI::System* cegui_system_;
CEGUI::OgreCEGUIRenderer* cegui_render_;
vgui_script::Base* script_;
vgui_window::Manager* windowmanager_;
vgui_icon::Manager* iconmanager_;
vgui_string::System* stringsystem_;
vgui_creature::head_board::System* creature_headboard_system_;
CEGUI::String buttonname_indragging_;
bool is_dragend_;
HCURSOR draggingcursor_;
bool active_paopao_;
bool is_ctrlinfo_enable_; //是否激活按住Ctrl键激活系统设置中所见所得功能
//是否用快捷键的设置,在游戏性设置部分 protected:
static System* self_; protected:
void on_dragbegin(CEGUI::FalagardActionButton* dranggingbutton_);
//拖动结束,targetbutton为目标button如果为空,则表示拖动到空白
void on_dragend(CEGUI::Window* targetwindow); }; }; //namespace vgui_base #endif //VGUI_BASE_SYSTEM_H_
解释
在讲述这里面的接口之前,我不得不吐槽一下园子了,最近发出的博文都无法正常进入首页了,里面就算不乏图文并茂的文章,其程度一直让博主觉得有些心灰意懒了。首先说发布博文的原因,那就是同大家交流与分享知识,没有太多别的目的。对于最近几天园子管理的调整,我也无心过问,但是我真心希望大家能够分享出一些能让大家进步的文章,也喜欢园子的管理能够发现这些文章并给予推广。
下面开始讲这部分的内容,最近在忙着写plain framework的参考手册,所以也就无暇来做之前的这些知识分享。而且客户端的部分,我觉得把这些重要接口展示给大家,大家如果能完全了解的话对于设计方面就已足够了,至于源码我会在讲解完这些接口后放出,所以大家不会担心。
基础系统提供了比较全面的UI操作接口,包括界面的显示与界面事件的控制。里面牵扯到几个重要的系统,包括OGRE、CEGUI、CEGUI RENDER、SCRIPT、窗口管理器、图标管理器、字符串管理器、角色面板管理器等等。
链接
最近在忙着整理plain framework框架的文档,但是文章被移出了首页,如果有兴趣的朋友不妨看看:http://www.cnblogs.com/lianyue/p/3972492.html
MMORPG大型游戏设计与开发(客户端架构 part2 of vgui)的更多相关文章
- MMORPG大型游戏设计与开发(客户端架构 part8 of vegine)
脚本模块是游戏设计中争论比较多的话题,那是因为作为脚本本身所带来的利弊.其实这都无关紧要,取舍是人必须学会的一项技能,如果你不会取舍那么就让趋势给你一个满意的答复.自从魔兽世界以及传奇(世界)问世以来 ...
- MMORPG大型游戏设计与开发(概述)updated
1.定义 MMORPG,是英文Massive(或Massively)Multiplayer Online Role-PlayingGame的缩写,即大型多人在线角色扮演游戏. 2.技术与知识 在这系列 ...
- MMORPG大型游戏设计与开发(UI SYSTEM SHOW)
接下来一段时间,这些文件可能不再更新,期间我会学习和掌握一些前端知识.虽然我非常欣赏剑侠网络版叁和九阴真经的画面,但是那是一个庞大的游戏引擎,一般人是无法窥伺的,除非你是天才而且要拥有机器毫无中断的毅 ...
- MMORPG大型游戏设计与开发(服务器 游戏场景 核心详述)
核心这个词来的是多么的高深,可能我们也因为这个字眼望而却步,也就很难去掌握这部分的知识.之所以将核心放在最前面讲解,也可以看出它真的很重要,希望朋友们不会错过这个一直以来让大家不熟悉的知识,同我一起进 ...
- MMORPG大型游戏设计与开发(游戏服务器 游戏场景 概述 updated)
我们在玩游戏的时候,我们进入游戏后第一眼往往都是看到游戏世界中的场景,当然除了个别例外,因为那些游戏将游戏场景隐藏了起来,如文字游戏中的地点一样.既然我们接触了游戏世界的核心,那么作为核心的场景又包括 ...
- MMORPG大型游戏设计与开发(客户端架构 part12 of vegine)
在游戏中的交互过程中输入是一个必不可少的过程,比如登陆的时候需要用户输入用户名与密码,就算是单机游戏很多时候也要求用户输入一个用户名作为存档的依据.网络游戏中没有了输入,只用鼠标来交互是不切实际的,因 ...
- MMORPG大型游戏设计与开发(客户端架构 part16 of vegine)
由于近来比较忙碌和有些困倦的原因,所以关于这部分的文章没有及时更新,一句话:让朋友们久等了!今天所讲的是客户端vengine(微引擎)中最后一个部分,就像上节所说,这一部分的内容比较多.可能有些朋友看 ...
- MMORPG大型游戏设计与开发(客户端架构 part9 of vegine)
时间在人们的生活中是多么重要的东西,如果打乱了时间,不知道这个时间会成什么样子.在客户端中,自然也有时间模块,因为不同的时间可能会处理不同的事情,特别是在追求高度自由化的同时,时间也成为了一个很重要的 ...
- MMORPG大型游戏设计与开发(客户端架构)
首先为所有等待的朋友说一声歉意,实在让大家等的太久.客户端的设计本来就是一个大的工程,而且工作的关系,也没有太多时间在这方面做研究.不过在私下有空的时间,我还是继续着这方面的研究,很遗憾没有用期望的o ...
随机推荐
- Eclipse中的Web项目自动部署到Tomcat
原因 很长时间没用Eclipse了,近期由于又要用它做个简单的JSP项目,又要重新学习了,虽然熟悉的很快,但记忆总是很模糊,偶尔犯错,以前很少写博客,现在感觉还是很有必要的,编程中每个人对于犯过的错误 ...
- Ajax关于readyState(状态值)和status(状态码)的研究
var getXmlHttpRequest = function () { try{ //主流浏览器提供了XMLHttpRequest对象 return new XMLHttpRequest(); } ...
- RecyclerView局部刷新那点事
1.局部刷新的引入 提到RecyclerView,我们首先想到的是ListView,对于ListView的局部刷新,我们之前已经有解决方案,[android:ListView的局部刷新]当时的解决方案 ...
- 获取设备的mac地址可靠的方法
参考自:http://www.open-open.com/lib/view/open1433406847322.html /** * 获取设备的mac地址 * * @param ac * @param ...
- umeng track 相关
NSString * appKey = @"57105bbbe0f55a7938002063"; NSString * deviceName = [[[UIDevice curre ...
- YYText-显示富文本
github地址: https://github.com/ibireme/YYText CocoaPods安装: pod 'YYText' 1.YYLabel使用注意 private lazy var ...
- 把应用push到/system/app上面后,出现java.lang.UnsatisfiedLinkError的问题
把应用push到/system/app下面后,加载.so库的问题 01-01 00:07:08.186: E/MessageQueue-JNI(2683): java.lang.Unsatisfied ...
- Android Activity动画
动画XML文件 slide_right_in.xml <?xml version="1.0" encoding="utf-8"?> <set ...
- Android音乐播放器源码(歌词.均衡器.收藏.qq5.0菜单.通知)
一款Android音乐播放器源码,基本功能都实现了 qq5.0菜单(歌词.均衡器.收藏.qq5.0菜单.通知) 只有向右滑动出现,菜单键和指定按钮都还没有添加. 源码下载:http://code.66 ...
- IOS 杂笔-1(为什么不继承类簇?)
答:首先,类簇是可以继承的,并不是不可以.例如,我们可以选择继承NSSting,但是此时你用你自己设定的类去调用NSSting的一些方法时,会存在无法实现的问题,这是为什么呢. 1.类簇里有很多私有的 ...