UI.HPP
#ifndef __QUESTUI_HEADER__@H_301_7@
#define __QUESTUI_HEADER__@H_301_7@
#include <typedef.hpp>@H_301_7@
#include <cocos-base.h>@H_301_7@
#include <TableView.h>@H_301_7@
#include "ScrollView.h"@H_301_7@
#include "WidgetProtocol.h"@H_301_7@
#include "cocos-ext.h"@H_301_7@
#include "cocos-widget.h"@H_301_7@
#include "QuestProxy.hpp"@H_301_7@
#include <list>@H_301_7@
#include <vector>@H_301_7@
CLIENT_NS_BEGIN
USING_NS_CC;
enum@H_301_7@ QuestUiBtn
{
tagCloseQuest,//退出按钮枚举;@H_301_7@
tagQuestGreyBtn,//添加灰阶枚举;@H_301_7@
tagQuestTestBtn //任务添加单元格按钮枚举;@H_301_7@
};
class@H_301_7@ QuestUi :
public@H_301_7@ CSceneExtension
{
public@H_301_7@:
CREATE_SCENE_FUNC(QuestUi)
QuestUi();
virtual@H_301_7@ ~QuestUi();
virtual@H_301_7@ void@H_301_7@ onLoadResources();
virtual@H_301_7@ void@H_301_7@ onLoadResourcesCompleted();
virtual@H_301_7@ void@H_301_7@ onLoadScene();
virtual@H_301_7@ void@H_301_7@ onEnterScene();
void@H_301_7@ onClickQuest(Ref* pSender);
void@H_301_7@ onSeverQuest(int@H_301_7@ Rid);
CWidgetWindow* m_pWindow;
//将任务过来的信息ID容器拷贝出来;@H_301_7@
std@H_301_7@::vector@H_301_7@<i32>@H_301_7@::iterator beg;
std@H_301_7@::vector@H_301_7@<string@H_301_7@>@H_301_7@QuestNameVe;
std@H_301_7@::vector@H_301_7@<string@H_301_7@>@H_301_7@::iterator nameBegin;
private@H_301_7@:
// 任务背景层;@H_301_7@
CC_SYNTHESIZE_READONLY(CCSprite*,m_pQuestBg,QuestBg);
// 任务退出Button;@H_301_7@
CC_SYNTHESIZE_READONLY(cocoswidget::CButton*,m_pCloseQuest,CloseQuest);
// 任务标题显示;@H_301_7@
CC_SYNTHESIZE_READONLY(CCSprite*,m_pQuestTitle,QuestTitle);
// 添加灰阶背景;@H_301_7@
CC_SYNTHESIZE_READONLY(cocoswidget::CButton*,m_pQuestGreyBgBtn,QuestGreyBgBtn);
// 循环任务Button;@H_301_7@
CC_SYNTHESIZE_READONLY(cocoswidget::CTableView*,m_pQuestView,QuestView);
CC_SYNTHESIZE_READONLY(cocoswidget::CButton*,m_pQuesButton,QuestCellButton);
// 添加任务名字信息;@H_301_7@
CC_SYNTHESIZE_READONLY(Label*,m_pTitleName,TitleName);
QuestProxy* m_pQuestPro;
private@H_301_7@:
Ref* gridpageviewDataSource(Ref* pConvertCell,unsigned@H_301_7@ int@H_301_7@ idx);
};
#define g_missionDalog QuestUi::getInstance();@H_301_7@
APP_NS_END
#endif __QUESTUI_HEADER__@H_301_7@
CPP
#include "QuestUi.hpp"@H_301_7@
#include <ScreenUtil.hpp>@H_301_7@
#include <CMisc.hpp>@H_301_7@
#include <Facade.hpp>@H_301_7@
#include <Language.hpp>@H_301_7@
#include "QuestMediator.hpp"@H_301_7@
#include <XmlConfig.hpp>@H_301_7@
CLIENT_NS_BEGIN
using namespace cocoswidget;
QuestUi@H_301_7@::QuestUi()//@H_301_7@ :
//m@H_301_7@_pQuestPro(nullptr)
{
setCachable(true@H_301_7@);
setAutoRemoveUnusedTexture(true@H_301_7@);
m_pQuestPro = (QuestProxy*)g_facade.retrieveProxy("QuestProxy"@H_301_7@);
//@H_301_7@ 拷贝容器;
//@H_301_7@ButSize = m_pQuestPro->ClientQuestInfo;
beg = m_pQuestPro->butsize.begin();
//@H_301_7@在构造里面不能用,这个样会导致先进入这个然后在获取所对应的值;
//@H_301_7@nameBegin = QuestNameVe.begin();
}
QuestUi@H_301_7@::~QuestUi()
{
}
//@H_301_7@ UI资源添加;
void@H_301_7@ QuestUi@H_301_7@::onLoadResources()
{
addImageAsync("QuestUi/DailyQuestBg.jpg"@H_301_7@);
addImageAsync("QuestUi/DailyQuestBg_alpha_mask.png"@H_301_7@);
addImageAsync("QuestUi/task_window_title_bg.jpg"@H_301_7@);
addImageAsync("QuestUi/task_window_title_bg_alpha_mask.png"@H_301_7@);
addImageAsync("QuestUi/close.jpg"@H_301_7@);
addImageAsync("QuestUi/close_alpha_mask.png"@H_301_7@);
addImageAsync("QuestUi/greyBg_1.png"@H_301_7@);
}
void@H_301_7@ QuestUi@H_301_7@::onLoadResourcesCompleted()
{
}
//@H_301_7@ 各种UI按钮界面显示展示;
void@H_301_7@ QuestUi@H_301_7@::onLoadScene()
{
//@H_301_7@ 添加灰阶背景;
m_pQuestGreyBgBtn = cocoswidget@H_301_7@::CButton@H_301_7@::create();
getQuestGreyBgBtn()@H_301_7@->@H_301_7@setNormalImage("QuestUi/greyBg_2.png"@H_301_7@);
getQuestGreyBgBtn()@H_301_7@->@H_301_7@setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
getQuestGreyBgBtn()@H_301_7@->@H_301_7@setPosition(ccp(0@H_301_7@,0@H_301_7@));
this@H_301_7@->addChild(getQuestGreyBgBtn());
this@H_301_7@->setTag(tagQuestGreyBtn);
//@H_301_7@ 添加背景图层;
m_pQuestBg = CCSprite@H_301_7@::create("QuestUi/QuestBg_1.png"@H_301_7@);
getQuestBg()@H_301_7@->@H_301_7@setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
getQuestBg()@H_301_7@->@H_301_7@setPosition(ccp(177@H_301_7@,90@H_301_7@));
this@H_301_7@->addChild(getQuestBg());
//@H_301_7@ 任务退出按钮的添加;
Texture2D* pCloseNormal = getNewTexture("QuestUi/close.jpg"@H_301_7@,"QuestUi/close_alpha_mask.png"@H_301_7@);
m_pCloseQuest = cocoswidget@H_301_7@::CButton@H_301_7@::create();
getCloseQuest()@H_301_7@->@H_301_7@setNormalTexture(pCloseNormal);
getCloseQuest()@H_301_7@->@H_301_7@setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
getCloseQuest()@H_301_7@->@H_301_7@setPosition(ccp(810@H_301_7@,490@H_301_7@));
getCloseQuest()@H_301_7@->@H_301_7@setTag(tagCloseQuest);
this@H_301_7@->addChild(getCloseQuest());
//@H_301_7@ 任务标题显示;
Texture2D* pQuestTitle = getNewTexture("QuestUi/task_window_title_bg.jpg"@H_301_7@,"QuestUi/task_window_title_bg_alpha_mask.png"@H_301_7@);
m_pQuestTitle = CCSprite@H_301_7@::createWithTexture(pQuestTitle);
getQuestTitle()@H_301_7@->@H_301_7@setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
getQuestTitle()@H_301_7@->@H_301_7@setPosition(ccp(137@H_301_7@,520@H_301_7@));
this@H_301_7@->addChild(getQuestTitle());
//@H_301_7@添加WINDOW 按键;
m_pWindow = CWidgetWindow@H_301_7@::create();
m_pWindow->setMultiTouchEnabled(true@H_301_7@);
m_pWindow->setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
m_pWindow->setPosition(ccp(0@H_301_7@,0@H_301_7@));
this@H_301_7@->addChild(m_pWindow);
//@H_301_7@任务滑动层
m_pQuestView = CTableView@H_301_7@::create(
Size(729@H_301_7@,415@H_301_7@),Size(600@H_301_7@,135@H_301_7@),0@H_301_7@,//@H_301_7@shu
this@H_301_7@,ccw_datasource_adapter_selector(QuestUi@H_301_7@::gridpageviewDataSource));
m_pQuestView->setDirection(eScrollViewDirectionVertical);
m_pQuestView->setAutoRelocate(true@H_301_7@);
m_pQuestView->setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
m_pQuestView->setPosition(Vec2(205@H_301_7@,115@H_301_7@));
m_pWindow->addChild(m_pQuestView);
beg = m_pQuestPro->butsize.begin();
nameBegin = QuestNameVe.begin();
}
void@H_301_7@ QuestUi@H_301_7@::onEnterScene()
{
g_facade.sendNotification(FRAME_MESSAGE_ENTER_QUEST_UI);
}
//@H_301_7@ 任务按钮循环创建;
Ref* QuestUi@H_301_7@::gridpageviewDataSource(Ref* pConvertView,unsigned int idx)
{
CTableViewCell* pCell = (CTableViewCell*)pConvertView;
CButton* pButton = nullptr;
if@H_301_7@ (!pCell)
{
pCell = new@H_301_7@ CGridPageViewCell();
pCell->autorelease();
//@H_301_7@ 添加
pButton = CButton@H_301_7@::createWith9Sprite(Size(600@H_301_7@,125@H_301_7@),"QuestUi/questFrameBg.png"@H_301_7@,"QuestUi/task_window_title_bg_alpha_mask.png"@H_301_7@);
pButton->setOnClickListener(this@H_301_7@,ccw_click_selector(QuestMediator@H_301_7@::onClickBtn));
pButton->setAnchorPoint(ccp(0@H_301_7@,0@H_301_7@));
pButton->setTag(tagQuestTestBtn);
pButton->setPosition(ccp(0@H_301_7@,0@H_301_7@));
pCell->addChild(pButton);
pButton->setUserTag(*beg);
//@H_301_7@名字显示在 单元格上;
m_pTitleName = CLabel@H_301_7@::create();
getTitleName()@H_301_7@->@H_301_7@setString(*nameBegin);
getTitleName()@H_301_7@->@H_301_7@setColor(Color3B(0@H_301_7@,0@H_301_7@));
getTitleName()@H_301_7@->@H_301_7@setPosition(Vec2(205@H_301_7@,115@H_301_7@));
pButton->addChild(getTitleName());
if@H_301_7@ (beg != m_pQuestPro->butsize.end())
{
beg++;
nameBegin++;
}
}
else@H_301_7@
{
pButton = (CButton*)pCell->getChildByTag(tagQuestTestBtn);
}
return@H_301_7@ pCell;
}
void@H_301_7@ QuestUi@H_301_7@::onClickQuest(Ref* pSender)
{
}
APP_NS_END
QuestMediator.hpp
上面的两个是UI展示部分也就是说能让玩家看到效果的演示而已
QuestMediator.hpp这里是UI部分的控制相当于说这里是大脑而UI是你的肢体
#include <typedef.hpp>@H_301_7@
#include <Mediator.hpp>@H_301_7@
#include <QuestUi.hpp>@H_301_7@
#include <MainMediator.hpp>@H_301_7@
#include <FortuneMediator.hpp>@H_301_7@
#include <QuestProxy.hpp>@H_301_7@
#include <stdio.h>@H_301_7@
CLIENT_NS_BEGIN
USING_NS_CC;
class@H_301_7@ QuestMediator :
public@H_301_7@ Mediator
{
public@H_301_7@:
QuestMediator();
~QuestMediator();
virtual@H_301_7@ void@H_301_7@ onRegisterNotification();
virtual@H_301_7@ void@H_301_7@ handleNotification(Notification* pNotification);
virtual@H_301_7@ void@H_301_7@ update();
virtual@H_301_7@ std@H_301_7@::string@H_301_7@ getMediatorName(){ return@H_301_7@ "QuestMediator"@H_301_7@; }
void@H_301_7@ onClickQuestInof();
private@H_301_7@:
CC_SYNTHESIZE_READONLY(QuestUi*,m_pQuestUi,QuestUi);
CC_SYNTHESIZE_READONLY(QuestProxy*,m_pQuestProxy,QuestProxy);
CC_SYNTHESIZE_READONLY(cocoswidget::CLabel*,TitleName);
void@H_301_7@ onClickBtn(CCObject* pObject);
};
APP_NS_END
CPP
#include "QuestMediator.hpp"@H_301_7@
#include <Facade.hpp>@H_301_7@
#include <MultiMediator.hpp>@H_301_7@
CLIENT_NS_BEGIN
QuestMediator@H_301_7@::QuestMediator() :
m_pQuestUi(nullptr),m_pQuestProxy(nullptr)
{
REGISTER_SCENE_FUNC(QuestUi);
m_pQuestProxy = (QuestProxy*)g_facade.retrieveProxy("QuestProxy"@H_301_7@);
}
QuestMediator@H_301_7@::~QuestMediator()
{
}
void@H_301_7@ QuestMediator@H_301_7@::onRegisterNotification()
{
m_xFrameMessageVec.push_back(FRAME_MESSAGE_SHOW_QUEST_UI);
m_xFrameMessageVec.push_back(FRAME_MESSAGE_ENTER_QUEST_UI);
m_xFrameMessageVec.push_back(FRAME_MESSAGE_EXIT_QUEST_UI);
}
void@H_301_7@ QuestMediator@H_301_7@::handleNotification(Notification* pNotification)
{
if@H_301_7@ (NULL == pNotification)
{
return@H_301_7@;
}
switch@H_301_7@ (pNotification->m_xMessage)
{
//@H_301_7@ 点击以后进入任务界面;
case@H_301_7@ FRAME_MESSAGE_SHOW_QUEST_UI@H_301_7@:
{
m_pQuestUi = (QuestUi*)LoadScene("QuestUi"@H_301_7@);
CSceneManager@H_301_7@::getInstance()@H_301_7@->@H_301_7@runUIScene(m_pQuestUi);
getQuestProxy()@H_301_7@->@H_301_7@clientQuestInfo = g_character.getQuestsqlInfovc();
//@H_301_7@拷贝上线时候的任务;
getQuestProxy()@H_301_7@->@H_301_7@butsize = getQuestProxy()@H_301_7@->@H_301_7@clientQuestInfo;
vector<int>::iterator itor = getQuestProxy()@H_301_7@->@H_301_7@butsize.begin();
vector<int>::iterator end = getQuestProxy()@H_301_7@->@H_301_7@butsize.end();
for@H_301_7@ (;itor!=end; itor++)
{
QuestXmlVo* sQ = getQuestProxy()@H_301_7@->@H_301_7@getQuestInof(*itor);
getQuestUi()@H_301_7@->@H_301_7@QuestNameVe.push_back(sQ->getQuestName());
}
//@H_301_7@广播当前任务信息;
//g@H_301_7@_facade.sendNotification()
}
break@H_301_7@;
case@H_301_7@ FRAME_MESSAGE_ENTER_QUEST_UI@H_301_7@:
{
if@H_301_7@ (getQuestProxy() == nullptr)
{
return@H_301_7@;
}
//@H_301_7@ 上线是反馈回来的长度;
m_pQuestUi->getQuestView()@H_301_7@->@H_301_7@setCountOfCell(m_pQuestProxy->butsize.size());
getQuestUi()@H_301_7@->@H_301_7@getQuestView()@H_301_7@->@H_301_7@reloadData();
getQuestUi()@H_301_7@->@H_301_7@getCloseQuest()@H_301_7@->@H_301_7@setOnClickListener(this@H_301_7@,ccw_click_selector(QuestMediator@H_301_7@::onClickBtn));
}
break@H_301_7@;
case@H_301_7@ FRAME_MESSAGE_EXIT_QUEST_UI@H_301_7@:
{
CSceneManager@H_301_7@::getInstance()@H_301_7@->@H_301_7@getRunningScene()@H_301_7@->@H_301_7@setModalable(false@H_301_7@);
CSceneManager@H_301_7@::getInstance()@H_301_7@->@H_301_7@popUIScene(m_pQuestUi);
FortuneMediator* pFortuneMediator = (FortuneMediator*)g_facade.retrieveMediator("FortuneMediator"@H_301_7@);
if@H_301_7@ (nullptr == pFortuneMediator)
{
return@H_301_7@;
}
pFortuneMediator->getFortuneUi()@H_301_7@->@H_301_7@setModalable(false@H_301_7@);
//@H_301_7@ 返回主场景;
MultiMediator* pMultiMediator = (MultiMediator*)g_facade.retrieveMediator("MultiMediator"@H_301_7@);
if@H_301_7@ (nullptr == pMultiMediator)
{
return@H_301_7@;
}
pMultiMediator->getMultiUi()@H_301_7@->@H_301_7@setModalable(false@H_301_7@);
}
break@H_301_7@;
}
}
//@H_301_7@ 状态的更新;
void@H_301_7@ QuestMediator@H_301_7@::update()
{
/*if@H_301_7@ (NULL == pNotification)
{
return@H_301_7@;
}
switch@H_301_7@ (pNotification->m_xMessage)
{*/
/*
//@H_301_7@任务数据更新以后;
case@H_301_7@ FRAME_MESSAGE_CHANGE_QUEST_UI@H_301_7@:
{
//@H_301_7@任务数据更新以后;
if@H_301_7@ (getQuestProxy() == nullptr)
{
return@H_301_7@;
}
//@H_301_7@ 上线是反馈回来的长度;
m_pQuestUi->getQuestView()@H_301_7@->@H_301_7@setCountOfCell(m_pQuestProxy->butsize.size());
getQuestUi()@H_301_7@->@H_301_7@getQuestView()@H_301_7@->@H_301_7@reloadData();
getQuestUi()@H_301_7@->@H_301_7@getCloseQuest()@H_301_7@->@H_301_7@setOnClickListener(this@H_301_7@,ccw_click_selector(QuestMediator@H_301_7@::onClickBtn));
}
break@H_301_7@;*/
//@H_301_7@ }
}
void@H_301_7@ QuestMediator@H_301_7@::onClickBtn(CCObject* pObject)
{
auto pButton = (cocoswidget@H_301_7@::CButton*)pObject;
if@H_301_7@ (nullptr == pButton)
{
return@H_301_7@;
}
switch@H_301_7@ (pButton->getTag())
{
case@H_301_7@ tagQuestTestBtn@H_301_7@:
{
//@H_301_7@任务ID;
auto tag = pButton->getUserTag();
QuestProxy* pQuestProxy = (QuestProxy*)g_facade.retrieveProxy("QuestProxy"@H_301_7@);
if@H_301_7@ (nullptr == pQuestProxy)
{
return@H_301_7@;
}
pQuestProxy->handleQuestcommpReq(tag);
}
break@H_301_7@;
case@H_301_7@ tagCloseQuest@H_301_7@:
{
CCLog("tagCloseQuest"@H_301_7@);
g_facade.sendNotification(FRAME_MESSAGE_EXIT_QUEST_UI);
}
break@H_301_7@;
default@H_301_7@:
break@H_301_7@;
}
}
APP_NS_END
UI到服务端的通信也就是传到服务端的信息,比如我是什么任务请求提交 或者完成 或者是否有这个任务等;传到服务端那边的只能是ID
如果你加入string huo这char 这些那么你就会增加通信量减缓消息的接受速度等;
#ifndef __QUEST_PROXY_HEADER__@H_301_7@
#define __QUEST_PROXY_HEADER__@H_301_7@
#include <typedef.hpp>@H_301_7@
#include <Proxy.hpp>@H_301_7@
#include <QuestXmlVo.hpp>@H_301_7@
#include "Character.hpp"@H_301_7@
CLIENT_NS_BEGIN
enum@H_301_7@ MyEnum
{
};
class@H_301_7@ QuestProxy : public@H_301_7@ Proxy
{
public@H_301_7@:
QuestProxy();
~QuestProxy();
virtual@H_301_7@ void@H_301_7@ onInitilize();
virtual@H_301_7@ void@H_301_7@ onRegisterMessage();
virtual@H_301_7@ std@H_301_7@::string@H_301_7@ getProxyName(){ return@H_301_7@ "QuestProxy"@H_301_7@; }
void@H_301_7@ handleQuestcommpReq(int@H_301_7@ ID);
//接收请求结果;@H_301_7@
void@H_301_7@ SeverQuestAgentTokenAck(Message::Ptr &message);
// Xml信息加载;@H_301_7@
QuestXmlVo* getQuestInof(int@H_301_7@ QuestID);
//服务端过来的信息ID容器;@H_301_7@
typedef@H_301_7@ std@H_301_7@::vector@H_301_7@<i32>@H_301_7@ ClientQuestInfo;
ClientQuestInfo clientQuestInfo;
//将任务过来的信息ID ClientQusetVo 容器拷贝出来;@H_301_7@
typedef@H_301_7@ std@H_301_7@::vector@H_301_7@<i32>@H_301_7@ ButSize;
ButSize butsize;
std@H_301_7@::vector@H_301_7@<QuestXmlVo*>@H_301_7@ XmlVo;
// 返回字典长度@H_301_7@
int@H_301_7@ getDirLength();
private@H_301_7@:
// 加载信息;@H_301_7@
void@H_301_7@ loadQuestInfo();
CC_SYNTHESIZE_READONLY(Character*,m_pCharacter,Character);
private@H_301_7@:
CC_SYNTHESIZE(CCDictionary*,m_pQuestInof,QuestInof);
};
APP_NS_END
#endif // !__QUEST_PROXY_HEADER__@H_301_7@@H_301_7@
CPP
#include "QuestProxy.hpp"@H_301_7@
#include <tinyxml2/tinyxml2.h>@H_301_7@
#include "GameServer/Quest.hpp"@H_301_7@
#include <Alert.hpp>@H_301_7@
#include <Facade.hpp>@H_301_7@
#include "QuestMediator.hpp"@H_301_7@
#include <NetDelegate.hpp>@H_301_7@
CLIENT_NS_BEGIN
QuestProxy::QuestProxy() :
m_pCharacter(nullptr@H_301_7@)
{
m_pQuestInof = CCDictionary::create();
m_pQuestInof->retain();
m_pCharacter = (Character*)g_facade.retrieveProxy("Character"@H_301_7@);
}
QuestProxy::~QuestProxy()
{
}
void@H_301_7@ QuestProxy::onInitilize()
{
loadQuestInfo();
// getDirLength();@H_301_7@
}
void@H_301_7@ QuestProxy::onRegisterMessage()
{
DEFREG_MESSAGE(ID_GS2C_ListQuestCommitAck,QuestProxy,SeverQuestAgentTokenAck)
}
//任务请求客户端向服务端发送消息;@H_301_7@
void@H_301_7@ QuestProxy::handleQuestcommpReq(int@H_301_7@ ID)
{
Message::Ptr sendMsg(new@H_301_7@ Message());
C2GS_QuestSubmitReq questSubmitReq;
questSubmitReq.nQuestID = ID;
sendMsg->pack(questSubmitReq);
g_netDelegate.send(sendMsg);
}
//接收请求结果;@H_301_7@
void@H_301_7@ QuestProxy::SeverQuestAgentTokenAck(Message::Ptr &message)
{
GS2C_ListQuestCommitAck sListQuestCommitAck;
message->unpack(sListQuestCommitAck);
std@H_301_7@::vector@H_301_7@<int@H_301_7@>@H_301_7@::iterator ite = butsize.begin();
std@H_301_7@::vector@H_301_7@<int@H_301_7@>@H_301_7@::iterator ender = butsize.end();
for@H_301_7@ (; ite != ender; ite++)
{
if@H_301_7@ (*ite == sListQuestCommitAck.nQuestID)
{
butsize.erase(ite);
break@H_301_7@;
}
}
g_facade.sendNotification(FRAME_MESSAGE_ENTER_QUEST_UI);
//QuestMediator* pQuestMediator = (QuestMediator*)g_facade->retrieveMediator(FRAME_MESSAGE_CHANGE_QUEST_UI);@H_301_7@
//pQuestMediator->;//->setMailInfoMap(mailInfoMap); */@H_301_7@
//g_facade.sendNotification(FRAME_MESSAGE_CHANGE_QUEST_UI);@H_301_7@
}
QuestXmlVo* QuestProxy::getQuestInof(int@H_301_7@ QuestID)
{
DictElement* pQuestElement = nullptr@H_301_7@;
CCDICT_FOREACH(m_pQuestInof,pQuestElement)
{
auto@H_301_7@ KeyQuestID = pQuestElement->getIntKey();
if@H_301_7@ (KeyQuestID == QuestID)
{
QuestXmlVo* QuestsInfo = (QuestXmlVo*)pQuestElement->getObject();
return@H_301_7@ QuestsInfo;
}
}
std@H_301_7@::vector@H_301_7@<int@H_301_7@>@H_301_7@::iterator ite = butsize.begin();
std@H_301_7@::vector@H_301_7@<int@H_301_7@>@H_301_7@::iterator ender = butsize.end();
for@H_301_7@ (; ite != ender; ite++)
{
QuestXmlVo* mVo = getQuestInof(*ite);
XmlVo.push_back(mVo);
}
}
//XML 客户端的配置读取@H_301_7@
void@H_301_7@ QuestProxy::loadQuestInfo()
{
ssize_t bufferSize = 0@H_301_7@;
unsigned@H_301_7@ char@H_301_7@* pBuffer = CCFileUtils::sharedFileUtils()->getFileData("QuestX.xml"@H_301_7@,"r"@H_301_7@,&bufferSize);
if@H_301_7@ (NULL == pBuffer)
{
return@H_301_7@;
}
tinyxml2::XMLDocument* pXml = new@H_301_7@ tinyxml2::XMLDocument();
pXml->Parse((const@H_301_7@ char@H_301_7@*)pBuffer);
tinyxml2::XMLElement* pNode = pXml->RootElement()->FirstChildElement();
QuestXmlVo* pQuestXmlVo = nullptr@H_301_7@;
while@H_301_7@ (pNode)
{
pQuestXmlVo = new@H_301_7@ QuestXmlVo();
// 任务ID;@H_301_7@
pQuestXmlVo->setQuestID(pNode->IntAttribute("QuestID"@H_301_7@));
// 任务名字;@H_301_7@
pQuestXmlVo->setQuestName(pNode->Attribute("QuestName"@H_301_7@));
// 任务资源;@H_301_7@
pQuestXmlVo->setQuestImageID(pNode->Attribute("QuestImageID"@H_301_7@));
// 任务线;@H_301_7@
pQuestXmlVo->setQuestGroup(pNode->IntAttribute("QuestGroup"@H_301_7@));
// 前置任务;@H_301_7@
pQuestXmlVo->setQuestRelate(pNode->IntAttribute("QuestRelate"@H_301_7@));
// 任务解锁等级;@H_301_7@
pQuestXmlVo->setQuestNlockGrade(pNode->IntAttribute("QuestNlockGrade"@H_301_7@));
// 任务类型;@H_301_7@
pQuestXmlVo->setQuestType(pNode->IntAttribute("QuestType"@H_301_7@));
// 任务目标参数1;@H_301_7@
pQuestXmlVo->setQuestTargetParam1(pNode->IntAttribute("QuestTargetParam1"@H_301_7@));
// 任务目标参数2;@H_301_7@
pQuestXmlVo->setQuestTargetParam2(pNode->IntAttribute("QuestTargetParam2"@H_301_7@));
// 任务目标参数3;@H_301_7@
pQuestXmlVo->setQuestTargetParam3(pNode->IntAttribute("QuestTargetParam3"@H_301_7@));
// 任务加权;@H_301_7@
pQuestXmlVo->setQuestWeight(pNode->IntAttribute("QuestWeight"@H_301_7@));
// 任务任务描述;@H_301_7@
pQuestXmlVo->setQuestDescription(pNode->Attribute("QuestDescription"@H_301_7@));
// 任务金币奖励;@H_301_7@
pQuestXmlVo->setQuestcoin(pNode->IntAttribute("QuestCoin"@H_301_7@));
// 任务水晶奖励;@H_301_7@
pQuestXmlVo->setQuestCrystal(pNode->Attribute("QuestCrystal"@H_301_7@));
// 任务经验奖励;@H_301_7@
pQuestXmlVo->setQuetsExp(pNode->IntAttribute("QuetsExp"@H_301_7@));
// 任务其他奖励类型;@H_301_7@
pQuestXmlVo->setQuestRewardType(pNode->Attribute("QuestRewardType"@H_301_7@));
// 任务其他奖励;@H_301_7@
pQuestXmlVo->setQuestReward(pNode->IntAttribute("QuestReward"@H_301_7@));
// 任务说明;@H_301_7@
pQuestXmlVo->setQuestRemark(pNode->Attribute("QuestRemark"@H_301_7@));
// 任务动作;@H_301_7@
pQuestXmlVo->setQuestACtion(pNode->Attribute("QuestACtion"@H_301_7@));
// 任务目标;@H_301_7@
pQuestXmlVo->setQuestDestination(pNode->IntAttribute("QuestDestination"@H_301_7@));
pQuestXmlVo->autorelease();
m_pQuestInof->setObject(pQuestXmlVo,pQuestXmlVo->getQuestID());
pNode = pNode->NextSiblingElement();
}
}
APP_NS_END