pathani.h
1: #ifndef _PATH_ANI_H_2: #define _PATH_ANI_H_3:4:5: /*
6: 初始发牌动画实现7: */8:9:10: #include <vector>11: #include <deque>12: using namespace std;13: #include "CEGUI.h"
14: #include "Timer_CeguiImpl.h"
15: #include <string>
16: using std::string;17: using namespace CEGUI;18:19: /*
20: |<- path 1 ->|21: ----------------------------- -22: | |23: | p24: | a25: | t26: | h27: | 228: | |29:30:31: */32: struct PathInfo
33: {34:35: PathInfo(int bx,int by,int ex,int ey,int _step);36:37:38:39: int beginx; //40: int beginy; //41: int endx; //42: int endy; //43:44: int step; // step45: int curstep; //46: };47:48: struct PathQueue
49: {50: deque<PathInfo> mPath;51: ~PathQueue(){mPath.clear();}52:53: //
54: void add(PathInfo &m);
55: bool OnTimer();
56: bool GetPosition(int &x, int &y);57: };58:59: class PathAniBase ;
60:61: struct WndPathAni
62: {63:64: PathQueue mPathQueue;65: PathQueue mPathQueue_Bake;66: PathAniBase * mDisPtr;67: string mTimerName;
68:69: WndPathAni();70: ~WndPathAni();71:72: CEGUI::Window *mWnd;73: Timer * mTimer;74:75: void Init(string nameTimer, string nameWnd, int w,int h,PathAniBase * ptr= NULL,CEGUI::Window * OnWhosTop = NULL);76:77: void Add(PathInfo m);
78:79: // 开始,调用计时器
80: void Begin(string imageName);81:82: void ClearPath(){mPathQueue_Bake.mPath.clear();}
83:84: // ----------------------------------------------------
85: bool handleUpdateTimer(const CEGUI::EventArgs& args);86:87: std::string GetTimerName()
88: {89: if(mTimer)
90: return mTimer->getName().c_str();
91: else
92: return "TIMER_NULL";93: }94: };95:96:97:98: #define DISPATCH_BEGIN_X 39799: #define DISPATCH_BEGIN_Y 400100: #define DISPATCH_END_X 397101: #define DISPATCH_END_Y 577102:103: #define CARD0_BEGIN_X 397104: #define CARD0_BEGIN_Y 577105:106: #define CARD0_END_X 221107: #define CARD0_END_Y 577108:109: #define CARD1_BEGIN_X 397110: #define CARD1_BEGIN_Y 577111:112: #define CARD1_END_X 310113: #define CARD1_END_Y 577114:115:116: #define CARD2_BEGIN_X 397117: #define CARD2_BEGIN_Y 577118:119: #define CARD2_END_X 397120: #define CARD2_END_Y 577121:122:123: #define CARD3_BEGIN_X 397124: #define CARD3_BEGIN_Y 577125:126: #define CARD3_END_X 485127: #define CARD3_END_Y 577128:129:130: #define CARD4_BEGIN_X 397131: #define CARD4_BEGIN_Y 577132:133: #define CARD4_END_X 573134: #define CARD4_END_Y 577135:136:137: //其他边初始手牌的动画位置信息-------------------------------------------
138: // side0 没用
139: #define SIDE_0_DISPATCH_BEGIN_X 1// 多张牌在一其是重叠的,此x坐标的位置是5张牌平铺的位置
140: #define SIDE_0_DISPATCH_BEGIN_Y 1141: #define SIDE_0_DISPATCH_END_X 1142: #define SIDE_0_DISPATCH_END_Y 1143:144: #define SIDE_1_DISPATCH_BEGIN_X 551 // 多张牌在一其是重叠的,此x坐标的位置是5张牌平铺的位置
145: #define SIDE_1_DISPATCH_BEGIN_Y 282146: #define SIDE_1_DISPATCH_END_X 727147: #define SIDE_1_DISPATCH_END_Y 282148:149: #define SIDE_2_DISPATCH_BEGIN_X 415// 多张牌在一其是重叠的,此x坐标的位置是5张牌平铺的位置
150: #define SIDE_2_DISPATCH_BEGIN_Y 147151: #define SIDE_2_DISPATCH_END_X 415152: #define SIDE_2_DISPATCH_END_Y 68153:154:155: #define SIDE_3_DISPATCH_BEGIN_X 225 // 多张牌在一其是重叠的,此x坐标的位置是5张牌平铺的位置
156: #define SIDE_3_DISPATCH_BEGIN_Y 282157: #define SIDE_3_DISPATCH_END_X 56158: #define SIDE_3_DISPATCH_END_Y 282159:160:161:162:163:164: class PathAniBase
165: {166: public:
167: void Init(int w,int h,CEGUI::Window *wndPtr = NULL){}168: void Begin(vector<int>&){}169: virtual void AniStop(string name){}170: };171:172: // 初始牌动画
173: class DispathAni : public PathAniBase174: {175: public:
176: void Init(int w,int h,CEGUI::Window* wndPtr = NULL,int side = 0);177: void Begin(vector<int>&);178:179: void AniStop(string name);180: private:
181: int mW;
182: int mH;
183: WndPathAni mWndAni[5];184: };185:186: //////////////////出牌的位置坐标//////////////////////////////////////
187: #define _SIDE_0_BEGIN_X_ 458188: #define _SIDE_0_BEGIN_Y_ 576189: #define _SIDE_0_END_X_ 373190: #define _SIDE_0_END_Y_ 419191:192: #define _SIDE_1_BEGIN_X_ 678193: #define _SIDE_1_BEGIN_Y_ 305194: #define _SIDE_1_END_X_ 573195: #define _SIDE_1_END_Y_ 285196:197: #define _SIDE_2_BEGIN_X_ 372198: #define _SIDE_2_BEGIN_Y_ 50199: #define _SIDE_2_END_X_ 373200: #define _SIDE_2_END_Y_ 175201:202:203: #define _SIDE_3_BEGIN_X_ 61204: #define _SIDE_3_BEGIN_Y_ 303205: #define _SIDE_3_END_X_ 126206: #define _SIDE_3_END_Y_ 285207: //////////////////////////////////////////////////////////////
208:209: // 进牌的位置坐标
210: #define _INCARDMAX_ 2211:212: #define _PATH_ANI_INCARD_BEGIN_X_ 530213: #define _PATH_ANI_INCARD_BEGIN_Y_ 419214: #define _PATH_ANI_INCARD_END_X1_ 485215: #define _PATH_ANI_INCARD_END_Y1_ 576216: #define _PATH_ANI_INCARD_END_X2_ 573217: #define _PATH_ANI_INCARD_END_Y2_ 576218:219: #define _IN_CARDS_STEP_NUM_ 6220: class InCardsAni: public PathAniBase221: {222: public:
223: void Init(int w, int h, CEGUI::Window* wnd = NULL);224: void Begin(vector<int> &);225: void Begin(int *array,int size);226: void AniStop(string name);227: private:
228: WndPathAni mWndAni[_INCARDMAX_];229: int mW;
230: int mH;
231: };232:233:234:235:236: class OutCardsAni: public PathAniBase237: {238: public:
239: void Init(int w, int h, CEGUI::Window* wnd = NULL);240: void Begin(vector<int> &);241: void OutCardsAni::Begin(int side, int cardId);242: void AniStop(string name);243: ~OutCardsAni(){}244: private:
245: WndPathAni mWndAni[4]; //
246: int mW;
247: int mH;
248: };249:250: class InCardsAniII: public PathAniBase251: {252: public:
253: void Init(int w, int h,CEGUI::Window* wndPtr= NULL);254: void Begin(int side, vector<int> &);255: void Begin(int side, int *array, int size);256: void AniStop(string name);257: private:
258: WndPathAni mWndAni[4][_INCARDMAX_];259: int mW;
260: int mH;
261: };262: #endif
pathani.cpp
1: #include "stdafx.h"
2: #include "PathAni.h"
3: #include "WindowConsole.h"
4:5: #include "SkrDBManager.h"
6: #include "SkrGame.h"
7: #include "SkrUI.h"
8:9: #include "CEGUI.h"
10: using namespace CEGUI;11:12: extern const char * g_DefaultCardImageName;13:14: PathInfo::PathInfo(int bx,int by,int ex,int ey,int _step) :15: beginx(bx),beginy(by),endx(ex),endy(ey),step(_step)16: {17: curstep = 0;18: }19:20:21: void PathQueue::add(PathInfo &m)
22: {23: mPath.push_back(m);24: }25:26: bool PathQueue::OnTimer()
27: {28: // 说明路径已经跑完
29: if(mPath.size() == 0 ) return true;30: else
31: {32: mPath.at(0).curstep = mPath.at(0).curstep + 1;33: int curstepII = mPath.at(0).curstep;
34: int stepII = mPath.at(0).step;
35: LogW("CurStrp=%d,step = %d",curstepII,stepII);
36:37:38: if(curstepII > stepII)
39: {40: mPath.pop_front();41: if(mPath.size() == 0) return true;42: else
43: return false;44: }45: }46: return false;47: }48:49:50: bool PathQueue::GetPosition(int &x, int &y)51: {52: if(mPath.size() == 0) return false;53: int xb = mPath.at(0).beginx;
54: int yb = mPath.at(0).beginy;
55: int xe = mPath.at(0).endx;
56: int ye = mPath.at(0).endy;
57: int curstep = mPath.at(0).curstep;
58: int stepCount = mPath.at(0).step;
59: x = xb + (float)curstep/(float)stepCount * (xe - xb);60: y = yb + (float)curstep/(float)stepCount * (ye - yb);61: }62:63:64: WndPathAni::WndPathAni()65: {66: mWnd = NULL;67: mTimer = NULL;68: }69:70: WndPathAni::~WndPathAni()71: {72:73: }74:75: void WndPathAni::Init(string nameTimer, string nameWnd, int w,int h,PathAniBase * ptr,CEGUI::Window * wndPtr)76: {77: using namespace CEGUI;78: WindowManager &winMgr = WindowManager::getSingleton();79:80: mTimerName = nameTimer;81: mDisPtr = ptr;82: //-------------------------------------------------------------------
83: // 初始化timer
84: char buff[200];
85: char buffWnd[200];
86: sprintf(buff,"%s_%u",nameTimer.c_str(),this);87: sprintf(buffWnd,"%s_%u",nameWnd.c_str(),this);88: mTimer = (Timer*)winMgr.createWindow("Timer",buff);
89: mTimer->setDelay(0.05);90:91: mTimer->setPosition(UVector2(UDim(0,0),UDim(0,0)));92: mTimer->setWidth(UDim(0,1));93: mTimer->setWidth(UDim(0,1));94:95: winMgr.getWindow("root")->addChildWindow(mTimer);
96: mTimer->subscribeEvent(Timer::EventTimerAlarm, Event::Subscriber(&WndPathAni::handleUpdateTimer, this));
97:98: // -----------------------------------------------------------------
99: mWnd = winMgr.createWindow("TaharezLook/StaticImage",buffWnd/*(string("PathAniWnd")+nameWnd).c_str()*/);100: mWnd->setWidth(UDim(0,w));101: mWnd->setHeight(UDim(0,h));102: mWnd->setPosition(UVector2(UDim(0,0),UDim(0,0)));103: mWnd->setMousePassThroughEnabled(true);
104: mWnd->setRiseOnClickEnabled(false);
105: winMgr.getWindow("root")->addChildWindow(mWnd);
106: mWnd->setAlwaysOnTop(true);
107: //mWnd->moveToFront();
108: mWnd->hide();109: mWnd->setProperty("FrameEnabled", "False");110: mWnd->setProperty("Image","");
111: if(wndPtr)
112: {113: mWnd->moveInFront(wndPtr);114: }115: }116:117:118: void WndPathAni::Add(PathInfo m)
119: {120: mPathQueue_Bake.add(m);121: }122:123: // 开始,调用计时器
124: void WndPathAni:: Begin(string imageName)125: {126:127: mPathQueue.mPath.clear();128: mPathQueue.mPath = mPathQueue_Bake.mPath;129: // 开始移动
130: mWnd->setProperty("Image",imageName.c_str());
131: if(mPathQueue.mPath.size() == 0)
132: {133: mTimer->stop();134: mWnd->hide();135: return ;
136: }137:138: int x = mPathQueue.mPath.at(0).beginx;
139: int y = mPathQueue.mPath.at(0).beginy;
140: mWnd->setPosition(UVector2(UDim(0,x),UDim(0,y)));141: mWnd->show();142: if(mTimer)
143: mTimer->start();144: else
145: {146: mWnd->hide();147: }148: }149:150: // ----------------------------------------------------
151: bool WndPathAni::handleUpdateTimer(const CEGUI::EventArgs& args)152: {153: bool b = mPathQueue.OnTimer();
154: if(!b)
155: {156: int x, y;
157: mPathQueue.GetPosition(x,y);158: mWnd->setPosition(UVector2(UDim(0,x),UDim(0,y)));159: }160: else
161: {162: mTimer->stop();163: mWnd->hide();164: if(mDisPtr)
165: {166: mDisPtr->AniStop(mTimer->getName().c_str());167: }168: }169:170: return false;171: }172:173:174: // 发牌的起始地址信息
175: const int g_Pos[10][2]=176: {177: { CARD0_BEGIN_X,CARD0_BEGIN_Y },{ CARD0_END_X,CARD0_END_Y },178: { CARD1_BEGIN_X,CARD1_BEGIN_Y },{ CARD1_END_X,CARD1_END_Y },179: { CARD2_BEGIN_X,CARD2_BEGIN_Y },{ CARD2_END_X,CARD2_END_Y },180: { CARD3_BEGIN_X,CARD3_BEGIN_Y },{ CARD3_END_X,CARD3_END_Y },181: { CARD4_BEGIN_X,CARD4_BEGIN_Y },{ CARD4_END_X,CARD4_END_Y },182: };183:184: // side 1 ~ side 3 的起止地址
185: //
186: const int g_DispatchOtherSide[8][2] =187: {188: { SIDE_0_DISPATCH_BEGIN_X,SIDE_0_DISPATCH_BEGIN_Y },{ SIDE_0_DISPATCH_END_X,SIDE_0_DISPATCH_END_Y },189: { SIDE_1_DISPATCH_BEGIN_X,SIDE_1_DISPATCH_BEGIN_Y },{ SIDE_1_DISPATCH_END_X,SIDE_1_DISPATCH_END_Y },190: { SIDE_2_DISPATCH_BEGIN_X,SIDE_2_DISPATCH_BEGIN_Y },{ SIDE_2_DISPATCH_END_X,SIDE_2_DISPATCH_END_Y },191: { SIDE_3_DISPATCH_BEGIN_X,SIDE_3_DISPATCH_BEGIN_Y },{ SIDE_3_DISPATCH_END_X,SIDE_3_DISPATCH_END_Y }192: };193:194: void DispathAni::Init(int w,int h,CEGUI::Window* wndPtr, int side)195: {196: char buff[100];
197: char buff2[100];
198: mW = w;199: mH = h;200:201: //----------------
202: int beginx,beginy,endx,endy,
203: int SinelePosXBegin,int SinglePosYBegin,204: int SinelePosXEnd,int SinglePosYEnd;205:206:207: for(int i = 0 ; i < 5 ; i++)208: {209: sprintf(buff,"DispatchTimer_%d_%d",i,side);
210: sprintf(buff2,"DispatchWnd_%d_%d",i,side);
211: mWndAni[i].Init(buff,buff2,w,h,this,wndPtr);
212:213: if(side == 0)
214: {215: mWndAni[i].Add(PathInfo(DISPATCH_BEGIN_X,DISPATCH_BEGIN_Y,DISPATCH_END_X,DISPATCH_END_Y,4));216: mWndAni[i].Add(PathInfo(g_Pos[2*i][0],g_Pos[2*i][1],g_Pos[2*i+1][0],g_Pos[2*i+1][1],8));217: }218: else
219: {220: beginx = g_DispatchOtherSide[2*side][0] - 0.9 * mW;221: beginy = g_DispatchOtherSide[2*side][1];222: SinelePosXBegin = beginx + i * 0.2 * mW;223: SinglePosYBegin = beginy;224:225: endx = g_DispatchOtherSide[2*side + 1][0] - 0.9 * mW;226: endy = g_DispatchOtherSide[2*side + 1][1];227:228: SinelePosXEnd = endx + i * 0.2 *mW;229: SinglePosYEnd = endy;230: mWndAni[i].Add(PathInfo(SinelePosXBegin,SinglePosYBegin,SinelePosXEnd,SinglePosYEnd,6));231: //mWndAni[i].Add(PathInfo(g_Pos[2*i][0],g_Pos[2*i][1],g_Pos[2*i+1][0],g_Pos[2*i+1][1],8));
232: }233:234: }235: }236:237:238: void DispathAni::Begin(vector<int> &v)239: {240: for(int i = 0; i < v.size() && i < 5; i++ )241: {242: Card* cPtr = SkrDBManager::GetInstance().GetCardByID(v.at(i));243: if(!cPtr)
244: {245: mWndAni[i].Begin(g_DefaultCardImageName);246: }247: else
248: {249: mWndAni[i].Begin(cPtr->thumbimg);250: }251: }252: }253:254:255: void DispathAni::AniStop(string name)256: {257: LogIm("发放手牌动画结束:timer'name is %s",name.c_str());
258: if(name.compare(mWndAni[0].GetTimerName()) == 0)
259: {260: CGameUser* usrPtr = SkrGamePtr->GetUserBySide_NotViewer(0);261:262: //
263: if(usrPtr)
264: SkrUI::GetInstance().ShowCardsInHand(*(usrPtr->GetHandCardMgr()));265: }266: }267:268:269: void InCardsAni::Init(int w, int h,CEGUI::Window* wnd)270: {271: char buff[100];
272: char buff2[100];
273: mW = w;274: mH = h;275: for(int i = 0 ; i < _INCARDMAX_ ; i++)276: {277: sprintf(buff,"InCardsAni::InCardTimer_%d",i);
278: sprintf(buff2,"InCardsAni::InCardWnd_%d",i);
279: mWndAni[i].Init(buff,buff2,w,h,this,wnd);
280: //mWndAni[i].Add(PathInfo(DISPATCH_BEGIN_X,DISPATCH_BEGIN_Y,DISPATCH_END_X,DISPATCH_END_Y,4));
281: //mWndAni[i].Add(PathInfo(g_Pos[2*i][0],g_Pos[2*i][1],g_Pos[2*i+1][0],g_Pos[2*i+1][1],8));
282: }283: }284:285: void InCardsAni::Begin(vector<int> & v)286: {287: int size = v.size();
288: mWndAni[0].mPathQueue_Bake.mPath.clear();289: mWndAni[1].mPathQueue_Bake.mPath.clear();290: // 如果是一张牌
291: if(size == 1)
292: {293: mWndAni[0].Add(PathInfo(_PATH_ANI_INCARD_BEGIN_X_,_PATH_ANI_INCARD_BEGIN_Y_,_PATH_ANI_INCARD_END_X2_,_PATH_ANI_INCARD_END_Y2_,10));294: }295: else if(size == 2)296: {297: mWndAni[0].Add(PathInfo(_PATH_ANI_INCARD_BEGIN_X_,_PATH_ANI_INCARD_BEGIN_Y_,_PATH_ANI_INCARD_END_X1_,_PATH_ANI_INCARD_END_Y1_,10));298: mWndAni[1].Add(PathInfo(_PATH_ANI_INCARD_BEGIN_X_,_PATH_ANI_INCARD_BEGIN_Y_,_PATH_ANI_INCARD_END_X2_,_PATH_ANI_INCARD_END_Y2_,10));299: }300:301: for(int i = 0; i < v.size() && i < _INCARDMAX_; i++ )302: {303: Card* cPtr = SkrDBManager::GetInstance().GetCardByID(v.at(i));304: if(!cPtr)
305: {306: mWndAni[i].Begin(g_DefaultCardImageName);307: }308: else
309: {310: mWndAni[i].Begin(cPtr->thumbimg);311: }312: }313: }314:315: void InCardsAni::Begin(int *array,int size)316: {317: vector<int> v;
318: for(int i = 0; i< size ; i++)319: {320: v.push_back(array[i]);321: }322: Begin(v);323: }324:325: void InCardsAni::AniStop(string name)326: {327: LogW("进牌动画结束 timer:%s",name.c_str());
328: }329:330: // 出牌的起止位置
331: const int g_SideOutCardsPos[8][2]=332: {333: { _SIDE_0_BEGIN_X_, _SIDE_0_BEGIN_Y_ },{ _SIDE_0_END_X_, _SIDE_0_END_Y_ },334: { _SIDE_1_BEGIN_X_, _SIDE_1_BEGIN_Y_ },{ _SIDE_1_END_X_, _SIDE_1_END_Y_ },335: { _SIDE_2_BEGIN_X_, _SIDE_2_BEGIN_Y_ },{ _SIDE_2_END_X_, _SIDE_2_END_Y_ },336: { _SIDE_3_BEGIN_X_, _SIDE_3_BEGIN_Y_ },{ _SIDE_3_END_X_, _SIDE_3_END_Y_ },337: };338:339:340: void OutCardsAni::Init(int w, int h,CEGUI::Window * wndPtr)341: {342: char buff[100];
343: char buff2[100];
344: mW = w;345: mH = h;346: for(int i = 0 ; i < 4 ; i++)347: {348: sprintf(buff,"OutCardsAni::InCardTimer_%d",i);
349: sprintf(buff2,"OutCardsAni::InCardWnd_%d",i);
350: mWndAni[i].Init(buff,buff2,w,h,this,wndPtr);
351: }352: }353: void OutCardsAni::Begin(vector<int> &)354: {355:356: }357:358: void OutCardsAni::Begin(int side, int cardId)359: {360: for(int i = 0 ; i < 4; i++)361: {362: mWndAni[i].ClearPath();363: }364:365: if(side <0 || side >= 4) return ;366: if(side == 0)
367: {368: int index = SkrUI::GetInstance().GetIndexByID(cardId);
369: if(index <0)
370: {371: LogIm("该id在手牌中找不到索引位置!");
372: index = 1;//return ;
373: }374: UVector2 pos = SkrUI::GetInstance().GetOutCardPosition(index);375: mWndAni[side].Add(PathInfo(376: pos.d_x.d_offset,377: pos.d_y.d_offset,378: g_SideOutCardsPos[side*2+1][0],379: g_SideOutCardsPos[side*2+1][1],380: 6)381: );382:383: }384: else
385: {386: mWndAni[side].Add(PathInfo(387:388: g_SideOutCardsPos[side*2][0],389: g_SideOutCardsPos[side*2][1],390: g_SideOutCardsPos[side*2+1][0],391: g_SideOutCardsPos[side*2+1][1],392: 6)393: );394: }395:396: // for suspend
397: mWndAni[side].Add(PathInfo(398: g_SideOutCardsPos[side*2+1][0],399: g_SideOutCardsPos[side*2+1][1],400: g_SideOutCardsPos[side*2+1][0],401: g_SideOutCardsPos[side*2+1][1],402: 6)403: );404:405:406: Card* cPtr = SkrDBManager::GetInstance().GetCardByID(cardId);407: if(!cPtr)
408: {409: mWndAni[side].Begin(g_DefaultCardImageName);410: }411: else
412: {413: mWndAni[side].Begin(cPtr->thumbimg);414: }415: }416:417:418: void OutCardsAni::AniStop(string name)419: {420: LogIm("出牌path动画完毕!");
421: SkrGamePtr->UnlockMsg();422: SkrUI::GetInstance().UpdateLastCard();423: }424:425:426:427: void InCardsAniII::Init(int w, int h,CEGUI::Window*wndPtr)428: {429: char buff[100];
430: char buff2[100];
431: mW = w;432: mH = h;433:434: for(int i = 0; i < 4; i++)435: {436: for(int j = 0; j < _INCARDMAX_; j++)437: {438: sprintf(buff,"InCardsAniII::InCardTimer_%d-%d",i,j);
439: sprintf(buff2,"InCardsAniII::InCardWnd_%d-%d",i,j);
440: mWndAni[i][j].Init(buff,buff2,w,h,this,wndPtr);
441: }442: }443: }444:445: void InCardsAniII::Begin(int side,vector<int> & v)446: {447: int size = v.size();
448:449: for(int i = 0; i < 4; i++)450: {451: mWndAni[i][0].ClearPath();452: mWndAni[i][1].ClearPath();453: }454:455: // 如果是一张牌
456: if(side == 0)
457: {458: if(size == 1)
459: {460:461: mWndAni[0][0].Add(PathInfo(_PATH_ANI_INCARD_BEGIN_X_,_PATH_ANI_INCARD_BEGIN_Y_,_PATH_ANI_INCARD_END_X2_,_PATH_ANI_INCARD_END_Y2_,4));462: }463: else if(size == 2)464: {465: mWndAni[0][0].Add(PathInfo(_PATH_ANI_INCARD_BEGIN_X_,_PATH_ANI_INCARD_BEGIN_Y_,_PATH_ANI_INCARD_END_X1_,_PATH_ANI_INCARD_END_Y1_,4));466: mWndAni[0][1].Add(PathInfo(_PATH_ANI_INCARD_BEGIN_X_,_PATH_ANI_INCARD_BEGIN_Y_,_PATH_ANI_INCARD_END_X2_,_PATH_ANI_INCARD_END_Y2_,4));467: }468: }469: else
470: {471: mWndAni[side][0].Add(PathInfo(g_SideOutCardsPos[side*2 +1 ][0],g_SideOutCardsPos[side*2 +1 ][1],472: g_SideOutCardsPos[side*2][0],g_SideOutCardsPos[side*2][1],4));473:474: mWndAni[side][1].Add(PathInfo(g_SideOutCardsPos[side*2 +1 ][0] + mW / 4,g_SideOutCardsPos[side*2 +1 ][1],475: g_SideOutCardsPos[side*2][0] + mW / 2,g_SideOutCardsPos[side*2][1],4));476: }477:478: for(int i = 0; i < v.size() && i < _INCARDMAX_; i++ )479: {480: Card* cPtr = SkrDBManager::GetInstance().GetCardByID(v.at(i));481: if(!cPtr)
482: {483: mWndAni[side][i].Begin(g_DefaultCardImageName);484: }485: else
486: {487: mWndAni[side][i].Begin(cPtr->thumbimg);488: }489: }490: }491:492: void InCardsAniII::Begin(int side,int *array,int size)493: {494: vector<int> v;
495: for(int i = 0 ; i < size; i++ )496: {497: v.push_back(array[i]);498: }499: Begin(side,v);500: }501:502: void InCardsAniII::AniStop(string name)503: {504: LogW("*********************进牌动画结束 timer:%s",name.c_str());
505:506: //
507:508: if(name.compare(mWndAni[0][0].GetTimerName()) == 0)
509: {510: LogW("side0 进牌动画结束");
511: SkrUI::GetInstance().UpdateCardsInHand_Side0();512: }513: }