BQ CIAO DVC VA DAO T30
TRUtING D3I HQC THANG LONG
KHOA LUAN TOT NGHIEP
NGHIEN ctru ENGINE DA NEN TANG COCOS2D-X
VA PHAT TRIEN (TNG DUNG LUYEN THI TOEIC
TREN THIET Di SMART PHONE
Gilo viIn huomg din : Ths. Le Minh Thin
Sink viten thyc hien : Wog Thanh Ting
Mii sinh vien : A16321
Clow& ngInh : Khoa hoe may tinh
HA NQI-2014
MVC LVC
CHI TONG 1. GI& TH1$U DV AN 3
1.1. Vii net vi smartphone Vift Nam- 3
1.2. Tim quan tryng ala TOEIC 6
1.3. Gifri thif
91 trang |
Chia sẻ: huong20 | Ngày: 07/01/2022 | Lượt xem: 374 | Lượt tải: 0
Tóm tắt tài liệu Khóa luận Nghiên cứu Engine đa nền tàng Cocos2D - X và phát triền úng dụng luyện thi Toeic trên thiết bị smart phone, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
fn Ong dung Isola thi TOEIC tren smartphone 6
1.3.1. Giai thieu img dung 6
1.3.2. Lqi feh ala Ong dung luyen thi TOEIC tren smartphone 7
CHliONG 2. COCOS2D-X ENGINE. 9
2.1. Gibi thifn vi Cocos2d-X 9
2.1.1. Su ra den cila Cocos2d-X vi Lich sfr ph& trien 9
2.1.2. Ti sao lai dung Cocos2d-X 11
2.2. KV& tree tong quan vi mai truing lint vile 14
2.2.1. Co du tit chat thu muc 14
2.2.2. Kien true Cocos2d-X engine 15
2.2.3. Mai truing llm viec 16
2.2.4. MOt s6 lop deg Wog thuong duce sfr dung 19
CHUONG 3. PHAN TECH flu CAU NGHI$P VV 32
3.1. Yin an nghifp vg 32
3.2. Su al User-Case cia ding clang 33
3.3. Anh zu yin au nghiep vg vi chic ning 34
3.4. Die ti chic ning hi thong 34
3.4.1. UC#01: Kiem tra kit nai man 34
3.4.2. UC#02: Deng nh$p silo he thong 35
3.4.3. UC#03: Deng Icy di khan 39
3.4.4. UC#04: !Gem tra phien ban vi cop nh$t du lieu 44
3.4.5. UC#05: To di WM vi ceu hdi tric nghiem 47
3.4.6. UC#06: Luyen tap 50
3.4.7. UC#07: Thi dui 56
CHUONG 4. THAT KE VA MIEN HMI UNG DUNG 63
4.1. Kiin trtic hi thong.. 63
4.2. Thiit id chi tat chic ning thi thfr. .64
4.2.1. Topic 65
4.2.2. MCQ 65
4.2.3. ConfigLoader 68
4.2.4. QuestionItem 69
4.2.5. FullTest 70
4.3. Thiit ki as sfr di lien 71
4.3.1. Met hinh quan he 71
43.2. Danh sigh cic bang vi mel to 72
4.3.3. Cac bang de lieu 72
4.4. Cii dit. .75
4.4.1. Lwa chon mei tmong 75
4.4.2. You ciu au hinh di at he thtmg 76
CHUtING 5. KET LUAN VA DJNH HUNG PHAT TRIEN 77
5.1. Kit qui dot iliac 77
5.2. Dinh hiring phit triin 77
PHV LVC — CODE MOT SO alit NANG CHINO 79
1. Chic thing kiim tra kit not ming . .79
1.1. Native code 79
1.2. Android code 79
1.3. IOS code 80
2. Chic ning kiim tra tii tip tin vi ghi vio be nha sir clang HttpRequest —81
3. Chic Ming to di thi 82
TM lien tham khio 86
DANH MVC 18 NH VI, SO DO VA BANG BLEU
Bing 2.1: So skit giea Cocos2d-X vi ck engine khic 13
Bing 2.2: Co ciu t6 chet thu muc trong Cocos2d-X 15
Bing 2.3: Bing inh xa kieu de lieu glita Java vi Native code 19
Bing 3.1: Bing inh xa yell ciu ng,hiep vp vi cher Wing 34
Bing 4.1: M8 ti cic bang trong co so de lieu 72
Hinh 1.1: Tec dO phit trien thi tru6ng smartphone tai Viet Nam 4
Hinh 1.2: T$' le stt dung smartphone phis theo khu Arc thenh thi vi nong thou tai Viet Nam
4
Hlnh 1.3: TS, I¢ smartphone pit he dieu hanh tai Viet Nam 5
Hinh 1.4: TS, le se httu Smartphone 6 m6i hia tutu tai Viet Nam 5
Binh 2.1: M8 kith phit hien Cocos2d-X 9
Binh 2.2: NOi dung tep tin IDE sau ;chi giii nen 14
Hinh 2.3: Kien tnic Cocos2d-X 15
Hlnh 2.4: Mai truerng lam viec 16
Hinh 2.5: Cic dei brung dugc ke that tfr CCNode 21
Hlnh 2.6: Hlnh inh minh hua "Nine patch" 23
Filth 3.1: Su d6 user-case c ►ia ling dung 33
With 3 2• Man hinh ding nhap 39
Hlnh 3.3: Ciao dien ding kf 43
HIM 3.4: Giao dien ding kjr vi thong bio 16i 43
Hinh 3.5: Giao dien khi khoi chay (mg dung 47
Hinh 3.6: Giao dien de hal Bang van bin vi cilu hai tic nghiem sau khi ley de lieu tfr
CSDL 54
Hinh 3.7: Man hinh hien thi dap an sau khi ngutri deng chcm dip in chinh xic 54
Hinh 3.8: Men hinh hien thi de bai clang am thanh kern hinh anh vi cau hal tic nghiem
sau khi ley de lieu to CSDL 55
Filth 3.9: Min hinh hien thi dap in sau khi ngutri dung chop dap an bi sai 55
Hinh 3.10: Man hinh sau khi vio chirc rang thi thu 61
Binh 3.11: Min hinh hien thj dash sich cic cAu hal trong chic ring thi thfr 61
Hinh 3.12: Min hinh hien thi kit qui thi thfr sau khi holm thinh bii thi 62
Hinh 4.1: Kiin Mk he thong 63
Binh 4.2: Sa d8 lop chi tiet ch0c Ming thi 64
So d6 3.1: So d61u6ng dog viec "ICiem tra kit n6i mpg" 35
Sa Qe 3.2: Sc d8 lutong tong viec "Bang nh$p" 36
So d6 3.3: Sa d6 trInh to "Ding nh.p" 37
Sa d6 3.4: So d6 Wong ding viec "Ding 10" 40
So d6 3.5: So d6 trinh to "Ding kg" 41
Sa d6 3.6: So Q6 1u6ng Gong viec "ICiem tra phiIn bin vi cop nh$t dit lieu" 45
So d6 3.7: So d6 trinh to "'Clem tra phien bin vi cep nhOt de lieu" 46
So M 3.8: Sa Q6 1u6ng &mg viec "Too de bii vi cfu hdi tric nghiem" 48
Sa d6 3.9: So d6 trinh tir "Tao de bii vi clu hdi tic nghiem" 49
Sc d6 3.10: So d61u6ng cong viec "Tao di bii theo chi di di chop" 51
Sa d6 3.11: So d6 trinh to "Too di be' then chi di di chip" 52
So d6 3.12: So d61u6ng ding viec "Thi the 57
Sa Q8 3.13: Sa d6 trinh to "Thi the 58
Sa dB 4.1: M8 hinh dia lieu quan he 71
L(:11 NoI DAU
Ngay nay, dien thoai di dung di fro thanh mkt trong nhung cong cu lien lye thiet yiu
mkt con ngubi. Ngoii chtk tang lien kw, cling vai str phut trier tins ding nghe, ket nOi man
du, dien than di Ong dm thwe trong bi nhieu img dung gild tri, dinh vl, mua sim, thanh
town truc tuyen,... vi trong bj ak img dung hqc tip nhu tir dien, chuong trinh office, luyen
thi... Su bung n6 ye cit so luqng vi chat luqng ala smartphone (dien thooi di dOng thong
minh) mot lin nfta lching (firth vj tri quan tong aim n6 trong cuOc song.
Viii rim tic lei (My tai Viet Nam, smartphone di c6 sit gia tang manh me ve mot so
Mang. Da dang chafing loci vi nhieu =lc gin phi hqp yid nhieu phin khtk kWh hung.
Hang loft citc smartphone giti re call Samsung, Nokia, LG... duqc bin nil thj tnrimg Viet
Nam, lchien viec si him nhing chiec smartphone cang trb nen ph6 bien vide clang Mtn bao
gib het. Theo khao sit colt Google, s6 ngubi clang smartphone di chiem den 20% din s6
caa Viet Nam 6 thin diem kheo sat qu5+1 niim 2013. Google cong b6 tb nghien aim Minh
vi trac twin curt Ngubi tieu clang Viet 2014 do Ong ty TNS thvc hien, ty' le sir dung
smartphone tang 61 20% len 36%. TS, le nay tuy thip hen t9 le truing binh 49% cult the gill,
hay 40% cos Than Lan, 51% Malaysia vi 85% cult Singapore, nhung mirc thug truing cho
they smartphone ngiy cang duqc chuOng clang d6i yeti ngubi tieu dung Viet. Ng,hien ciru
coca Google can cho they 50% s6 ngubi duqc MN se khong bao gib rid khei nha me khong
c6 smartphone trong fay. Dien thotti di dung vai nhieu tien ich va 6 ben ngubi clang m9i
18c m9i not Ben canh d6, told Viet Nam, PC va Laptop at.) dO phti khong rung biing dien
thati. Do vey ma dien thoai di dung di va dang tre thanh phucmg tien d6ng vai tr6 quan
trong trong dbi song cult ngubi Viet.
Trong se nhttng ngtrbi so hitu smartpone tai Viet Nam, nhanh cheng flip con va de
tiep thu cong nghe mid, do d6, them ngubi tre to 16 - 24 mei s6 hOu smartphone nhiiu
nhat, chiem tjr le han 50%. Tam d6 at ra ban tam cho cic nha cung cap dich vu tren
smartphone nhim khai thac nhu ciu ctia them Mich hang 6 lira Si nay. Ngoai viec s*
clung smartphone de ket noi Internet, tin Mem thong tin tut tuyen, nghe nhac... ngubi saY
dung ce the hqc top moi Mc moi nai. Nim bit duqc biting do, ngay cang c6 nhieu nha
cung cap dua ra img dung hqc tip tren smartphone, ngubi hoc co the chit dOng lam cho qua
trinh hoc tip trir nen th6 vj vi lei coon hat. Trong so d6, ca9cc Ong dung hoc Tieng Anh rot
duqc tra chuOng. Tnroc day Ltd Viet Nam, nhieu c8ng ty, doanh nghiep, to thubng
sir dung chimg chi tieng Anh phin chia theo cap dO A, B, C (chimg chi ABC) nhu mot tieu
chi ngoai net di dua ra quyet djnh ye tuyen dung, b6 nhiem, sip lip thin sit hay b6 tri
1
nhan vien to ng,hiep tai nu& ngoli. Tuy nhien trong ck nAm lit Iai day, chung chi TOEIC
nei len nhu mUt tieu chain phi. biin hon di danh gia trinh dO thong thao ding Anh
ngutri lao dung. Xuit phat tfr thvc ti do, nhieu trubng Dai hoc, Cao ding di dim TOEIC
vac) chucmg trinh giang day Nit lva chon WU thi TOEIC di theo dOi sv tiin 130 trong viec hoc
tieng Anh d6i vai sinh vien then thing h9c nAm hgc ho(ic sit dung lam chuin tau ra ding
Anh cho sinh vien tot nghiep. Chink vi nhttng 15, do de nen viec hoc TOEIC, luyen thi
TOEIC va tham dv kt thi TOEIC dung vai fro quan tong trong viec chuin bj Muth tang
kien tittle v6i Watt sinh vien va ngueri di lam.
Tnrec nhu ciu hoc TOEIC ngay cang gia tang vet veri y twang hoc top hen smartphone,
the gia chon di di: "My chmg ting Luyen thi TOEIC hen cac thiit hi smartphone". Sv
than!' aping cua di tai mang 1pi cho cling ding meot Ong dung co tinh thvc tiin cao, glop
nguai sir dung co them cong eta di hoc tip lien dung.
NOi dung ctla Idles Won nay duqc chive thanh 4 chucmg:
Chuang 1: Giai thieu ye dv an
Chuang 2: Ting quan vi Cocos2d-X Engine
Chuang 3: Phan tich yeu ciu bah town
Chuang 4: That ki va then ;dui
Chuang 5: Kit luin
2
CHUDNG 1. GIOI THICU DV AN
1.1. VII net vi smartphone tai Viet Nam
Cac chuyen gia cola Google cho rang smartphone da trey thanh mOt plan Icheong the
thieu trong cuOc song vi hien tai ding dam ra mOt "cuOc cach mpg smartphone". Theo
khao sat cola Google, so ngubi dimg smartphone di chiem den 20% din s6 COB Viet Nam 6
thbi diem Ichio sat, tic quf I nam 2013. Nghien dm cola Google cho they 70% s6 ngubi
duqc hOi tra lbi h9 si dung smartphone de truy cop Internet, 50% se kung bao gib reri khOi
nhi mi khong ceo smartphone trong tay. Dieu thy cho thay neu cac doanh nghiep hitt cic
sir dung smartphone thich mOt phan cot lOi trong chi& Itrqc cis minh thi sa ket n6i vi tiep
cAn duqc vii ngubi tieu ding mei. Simon Kahn, Tting giam d6c Marketing Google chau A
Thii Binh Ducmg (Chief Marketing Officer, Asia Pacific) cho bi& smartphone di thay d6i
hanh vi ngubi tieu dung. Theo khao sat cis Google, ceo den 92% ngubi dimg smartphone
ce the lim nhieu viec cling lice Tai Dien din nap thi Truyen thong CMO Viet Nam nam
2013, doanh nhan cong nghe Bryan Pelz di khimg djnh, sox djch chuyen cia deri sting xi hOi
vio Internet vi Mobile II tat yen.
Nam 2014, ngubi Viet Nam bit du e6 nhing buoy tien hon trong cong nghe khi tS,
, le din se sir dung smartphone toi Viet Nam di le sir dung smartphone gia tang &mg Ice. TS
tang len Iron 36%, gin gap dei so yea 20% cilia nam 2013, trong de gi6i tre to 16-24 tu6i
chiem hon phan nth (58%), nhOm tu6i trung nien 35-44 tang 14% so v6i nam ngoitili 17%.
Trong khi tSr le ding may tinh a bin (desktop PC) chi tang gin 5%, (fat 44% din so. Una
theo bing khao sat, Viet Nam dimg thit 2 tong khu Arc Thing Nam A ve t6c dO dip con
tilling cong nghe mOi theo thj truing, chi sau Philippines. Trong do, 59% ngubi Viet Nam
chi ra ring cong nghe mOi mang den nhieu co hOi cho h9 hon rui ro. Nhing con so tang
throng lac quan nay den to nhieu yeu t6, trong d6 chi yeu li thai dO lac quan, thich nghi
nhanh vii cong nghe mai vi dO phi rung cola smartphone. Ben earth de gia thrInh
smartphone new cang re. Phan khuc smartphone binh din hien rat da clang, gii 2-3 trieu
&gig, um cc hOi cho m9i ngubi, bao gem h9c sinh sinh vier, ser hitu mOt chiec dien thotti
thong minh. tang mang t4i Viet Nam cG dO phi rOng [dip ngubi ding len inimg de ding.
Dien Din Hiep HOi Mobile Marketing toi Viet Nam 2014 ngiy 30 thing 10 nam 2014 di
dua ra nhUng con s6 thong k8 An urgng vi smartphone tai Viet Nam. Trong do: Viet Nam
li thi truing smartphone c6 tec go phat thin I6n thir 2 Chau A vi deng thbi ding la thj
truing cry mirc dO ph6 bien smartphone I6n thin 2 6 khu we Bong Nam A;
3
Hinh 1.1: Mc do phat trien thi Irwin smartphone tai Viet Nam
Vietnam is the second most populated
smartphone market in SA 34.3
a 0 alb .sae'
n e.
tam Afikvst..
Hinh 1.2: 7:9 le sti dung smartphone plan theo khu virc thanh thi vet ?Ong then tai Viet
Nam
48.6% smartphone dimg hg dieu hi nh Android vi 19.7% dung hg dieu hanh IOS.
4
Hinh 1.3: Ty 1e smartphone phiin he cli& hanh tai Viet Nam
O mOi lira tu6i, tS/ I sir dung smartphone co str khac biet Ian. Trong do cao nhAt la
nh6m tu6i tir 15 den 29 tu6i. Co 56,5% ngtrai trong dO Mei 20 — 24 tu6i dang so hftu
smartphone.
Ty 'e se hut Smartphone trong moi Kra tad
to Viet Nam
60.0
50.0
40.0
30.0
20.0
10.0
6.9
0.0
15-19 20-24 25-29 30-34 35-39 40-44 45-49 50-54
Hinh 1.4: TS, le so hail Smartphone o mai hia tudi tai Viet Nam
Dan vi:
Qua nhcmg con s6 va th6ng ke tren day, co the thAy thi traang smartphone tai Viet
Nam dang co stir tang truemg an Ming. Nh(tng ngutri tre tu6i chiem cao nhat trong s6
5
nhOng ngtrai se hau smartphone. Day cOng la Whom dal ttrqng c6 nhu c.Au 16n nhat lie hqc
t#p va tich lily Icien that phoc vo cho cong viec, cho cic nhu au a nhan. Doa tren nhttng
ca se d6, hoan toan c,6 tient &Mg de phit then de ling dung hqc top tren smartphone.
1.2. Tim quan trong cost TOEIC
Trong nOi dung Inc tieng Anh ce the tom chia lim hai loci• Anh ngft hqc thu$t (dung
de xin hoc bang, du hqc...) va Anh net giao tikp (sir dung thtrimg ngay, phoc vo cho nhu
au tong viec...). NM ming hqc thutt la din truing cim hai loci chimg chi TOEFL (colt
Vien Kiem djnh giio doc Hoa Kjr) va IELTS (cart DH Cambridge — Anh), thi ming giao
tiep chimg chi TOEIC dang dOc chiem so cOng thin cim tin throng sir (long lao dung the
gi6i.
TOEIC (cOng cart Vien Kiem djnh giio doc Hoa K5' cep) kh8ng yeu ciu qui cao lie
cic kien thin, ma chi can ngutri hqc dat duce muc dick sir dung tiling Anh. TOEIC da tra
thanh *it trong nhttng chuong trinh kiem tra Anh net quick to duqc nhieu nguai biet din.
Han 70 tong cOng ty, c8ng ty, cic to chirc trong nuOc va nuOc ngoiti hoot &Ong tin Viet
Nam di sir clung TOEIC nhu mOt lieu chart bat buOc trong cOng tic lieu chain hea vi
tuyen dung cin 1)0 nhu: Samsung, LG, FPT, Nein hang Sii Gen Thuong tin, Vietnam
Airlines... Rieng trong linh voc cloy nghe, TOEIC Viet Nam phai hqp vai Ttmg coc Dor
nghe )(ay dtmg thi diem lieu chain ye trinh dO sfr dung tieng Anh cho sinh vien nit nghiep
hai nginh tin hoc va then dr 6 twang cao ding Icy thurit. Ngorli ra, mOt do an turn to gifts
TOEIC Viet Nam phei hqp voi BO GD-DT vi Tang clic Du ljch nhim dinh gii vi xly
thing tieu chuin trinh dO sir dung tieng Anh thong qua chuong trinh chuttn TOEIC cling
ducat trien khai.
Diem TOEIC duqc tit ca cic ca quan nhi nuac, t6 chin queic te, doanh nghiep nuOc
ngoai va cic Sp doin kinh to curt Viet Nam Gang nh#n nhim &nit gii trinh do ding Anh
cim than so vai to cich la mOt thtrac do chain va ding tin coy nhat.
1.3. GM thiln ling dung luyin thi TOEIC train smartphone
1.3.1. Gidi Mien an dyng
"Luyen thi TOEIC tren smartphone" II ling dung luyen thi ding Anh tren dies thooi
c6 bao g6m day dit cic bai on tip vi de thi min theo ciu trac mOt de thi TOEIC tieu chat
Ong cluing duqc thiet Ice veri lieu chi nho gcm, a sir dung.
Ng clung duqc 18p trinh bang engine Cocos2d-X, li 1 engine ha trq lip trinh Game
da nen tang: Mobile (I05, ANDROID, Blackberry, TIZEN, WP) Window, MacOS,
HTML5... la 1 engine duqc dinh gii khi moth, da phit triers nhieu Game nam TOP cart
6
Appstore, CHPlay. Uu diem chi tiet ciut Cocos2d-X duqc trinh bay tai chuung 2 tea Ithea
14n.
Cocos2d-X la m0 engine mien phi, von Cocos2d-X tic gia c6 the )(ay dyng mOt img
dyng luyen thi TOEIC WA uu diem vuqt trOi:
—Dung lucmg thip (thip nhit c6 the la 1.5MB), khong drai hOi phien ban phin mem
di dOng qua cao. Dieu nay se giep ngubi sir dyng c6 the cii at ung dyng ma thong
can qua lo ling ve hi) nhe hay du hinh cea dien thoai.
—Ong dung chay da nen tang, vier code mOt lin, chay duqc cho nhieu h'e thin khic
nhau. NM de, tac gia till kiem &gm thin gian, chi phi va tang hien qua sir dyng vi
twang thich von nhieu he dieu hanh khic nhau, c6 the chay tren nhieu ding
smartphone.
Tir d6, tac gia mong muOn se dui ra sin phim luyen thi TOEIC tat nhit tren
smartphone v6i chi phi va nguOn lyc thip nhit.
L3.2. Lai tech cda sing dyng luyen thi TOEIC trim smartphone
Huang dao to thyc dyng nhu TOEIC c6 thin gian tnmg birth de c6 the thi lay chimg
chi la khoitng 18 twin cho den 2 nilm, phi thuOc vac fling lyc ngubi lye, mac diem muc
tieu vi 300400 diem di duqc xem la "pass — dat" cho den 990 diem. Ong dung luyen thi
TOEIC tren smartphone se la Ong cu hem fch cho ngubi hoc vi nheng uu diem sau day:
—De se' dung, tiet kiem then gian va chi phi
Vi qua tranh luyen thi duqc thyc hien qua dien thoai, nen tiet kiem duqc nhUng khans;
thin gian ma ngubi hqc phii lieu ten khi di chuyen den trung Ulm va di vi. Nhiiu ngubi can
mat nhieu thin gian hcm de di den cac trtmg tam nim 6 xa. Nguiri sir dung c6 the chit dOng
sip xep hoc tranh the thing khoang thei gian ninh n6i trong ngiy de hqc t$p. Ong dung
duqc cii chit tren dien thoai, lien dung va kherng did Uri qua nhieu ve mot khong gian vi
thin gian deti von ngubi sir dyng.
—Tinh ling dung va linh hot
Luyen thi TOEIC chi bao gem do ky Wing nghe hien vi dqc hieu, rat phi hqp tan
khai tren smartphone. Thyc to ngubi hoe thubng copy cite bai nghe Tieng Anh vac dien
thoai de c6 the sir dung 6 mqi ncri, thong phi thuOc vito may tinh hay internet, sach v6...
Vin (mg dyng luyen thi TOEIC, ngubi hqc holm town cit the chi can sir dung chiic dien
thogi nhu mOt giao tranh he top hien qua.
7
Ngoii ra, tinh img dung vi linh host con the hien 6 mi diem khi nguiri dung co the
Wen thi ma khong can mang quit nhieu Si lieu theo nguei. CM vii chiec dien thoai nhe
gqn, ngtrei sir dung co the bit dill bid hgc 6 mgi dja diem vi thin gian, khong bj phu thuOc
theo met then khoa bieu cg the. Tinh linh hog con the hien 6 fir djnh hues% vi fir dieu
chinh.
— Txr djnh hueng vi dieu chinh
Trong qui trinh luyen tip, nimbi dung co the fir djnh huUng cho minh, Ming cich chgn
khea bee ph4 hqp nhit d6i viii trinh dO, so thich, mix tieu cua bin than, dieu ray khic phuc
dugc cic han the khi luyen thi 6 the lap hgc vi thing tam khi trinh dO hgc vien khong ding
deu. Nprei hgc cOng chi dOng fir dieu chinh nhjp dieu khea hgc cho minh, ngbia li co the
hgc chin hay nhanh do thin gian minh ty sip xep hay do khi thing tiep thu Iden thirc ala
mirth.
8
CHUCING 2. COCOS2D-X ENGINE
2.1. Gild thilu ve Cocos2d-X
2.1.1. Sir ra 141 cda Cocos2d-X vd lick sir ph& trim
Thing 2 nlim 2008, tai thj tan "Los Cocos" gin Cordoba ar Argentina, Ricardo
Quesada, met nha phit trien trO chai da tao ra met ding cu tr6 chai 2D cong vei nhom coa
mInh. Ho at ten cho no la "Los Cocos". MOt thing sau, thorn phit hanh phien ban 0.1 va
dOi ten thanh "Cocos2d".
Thing 11 Sim 2010, mot nhOm nha phit trien tfr Trung ()MSc la Walzer Wang,
Minggo Zhang, James Chen va cOng su tfr ChuKong Technologies da phit trien Cocos2d-
X din teen Cocos2d. ChuKong Technologies la tong ty hang diu ve nen tang, giai tri di
dOng, vOi dei ngii hon 800 nhan vien, ngculi tru sir chinh tai Bic Kinh, Chu Kong cling c6
van pheng tai Menlo Park (USA), Tokyo (Japan), Seoul (Korea), va Taipei (Taiwan).
Cocos2d-X la mot cong cu ma nguen m6 theo gay pile') MIT. MIT la loci gay ph6p
sir dung cho ctic phtm mem, cic ma ngu6n mer dirqc phit trien dtra ten' met loci gitty phop
co ngtilin &tic tai Vien Ding nghe Massachusetts (Mn').
Minh 2.1: Mo hinh phdt trier Cocos2d-X
9
Cocos2d-X xuit xir to g6c li Cocos2d, engine game 2D viet tren Python, tuy nhien
da duqc vOn chuyen sang rat nhilu neon nip khk, thu het nhieu ngtrai sir dung tren the
gi6i, nhieu nhit li ban Cocos2d-X danh cho iOS. Cocos2d-X 11 ban port duqc vier bing
C-FE, thay vi Objective-C nhu bin g6c, nut de ma nguei lop trinh c6 the xay dung game
tren nhieu he may chi bling 1 lin code, cic he may bao gam Windows, Linux, Mac, iOS va
Android. Cocos2d-X di chiem duqc su ling hO 16n trong giai game developer to khi phat
hanh. Cocos2d-X c6 the ducrc sir dung di xay dung the Ire chai, ling dung vi c.ac chuang
trinh tuang tic dtra tren nen tang giao dies khic nhau. Cocos2d-X la engine duqc se dung
rung rai tren town the gi6i, v6i hart 400.000 nhi phit trien, bao gam cit cac nhit phat tan
ctia the tr6 chai ding Top 10 ten the store 16n Whit the giai nhu AppStore, GooglePlay
Store.
Ngay nay, nhieu nguai Cocos2d-X trong cac tr6 chcri thong tri bang xep hang Top
doanh thu eta AppStore vi Google Play, &lc biet la 6 Trung Quec, Han Quec vi Nhot Bin.
Ck Icy su to Chukong, Google, Microsoft, ARM, Intel vi BlackBerry dang tich cue them
gia xay dung along ding Cocos2d-X Nhitng ten Si 16n nhu Zynga, Wooga, Glu, IGG, Big
Fish Games, Fingersoft, Gamevil, GREE, DeNA, Konami, CT E & M, MIN, LINE, Square
Enix,... a sir dung Cocos2d-X de phat trien tr6 chai cult hq.
Tom tit Lich sty ph& thin cim Cocos2d-X:
—Nam 2010: Thing 7 nam 2010, du an Cocos2d-X duqc din ra vi den thing 11
duqc phit birth phien ban 0.7.0.
—Nam 2011:
+ Thing 1 nam 2011, Cocos2d-X phien bin chinh thirc du tien duqc ph& hanh.
+ Thing 2 nam 2011, tro chai FishingJoy duqc ported tren Android.
+ Thing 10 nam 2011, thiet lop plan mem Coco, du to bOi Chukong.
+ Thing 11 nam 2011, chiem vi tri thin 1 va thir 2 tr6 chai Appstore.
—Nam 2012:
+ Thing 3 nam 2012, ra mit Cocos2d-html5
+ Thing 5 nam 2012, phat hanh v2.0 Cocos2d-X
+ Than 6 nam 2012, Ichai dung Cocos Studio
+ Than 9 nam 2012, Cocos2d-X chiem 6 trong se 10 tr6 chai hang dAu co doanh
thu cao nhAt a Trung Quec
10
—Nim 2013:
+ Thing 1 nim 2013, Cocos2d-X chiem 7 trong s610 tr6 chai hang dau c6 doanh
thu cao !that Trung Quec, 5 vi tri himg diu cho ci iPhone vi Wad.
+ Thin 3 ram 2013, sich Cocos2d-X duct mat bin.
+ Thing 4 nim 2013, game c6 doanh thu cao nhat tai Him Queic Google Play Store
phit trier tir Cocos2d-X.
+ Thing 10 nim 2013, tic gii cua Cocos2d-iphone gia nhop Chukong.
+ Thing 11 nim 2013, Cocos2d-X chiem 9 tren 10 vi tri hang diu trip chai ce
doanh thu cao nit& tai Hin Qua& Google Play Store.
—Nim 2014:
+ Thing 3 nam 2014, Cocos2d-X chi& 4 trong 11 vi tri hang du. trong de trip
chai c6 doanh thu cao nhit WeChat
2.1.2. Tgi sao igi ding Cocos2d-X
2.1.2.1. Liu diim cua Cocos2d-X
—Cocos2d-X la mOt engine da nen tang
Day li mOt lqi the rat len cos Cocos2d-X khi mi game lim ra az.) the chay tren cic
nen Ling !chic nhau nhu Linux, Mac, Windows 8, Android, iOS, Windows Phone 8,
BlackBerry hay ci HTML5. biet, t$p trung vio ba nen tang di dOng ph6 bien da to
nen sat hap din cua engine nay khi ma thi phin tic thiet bi di dOng dan dang chiem linh
may tinh ci nhan.
Hien tai, Cocos2d-X ha trq tic nhi phit trien game tren tic nem nga nhu C++,
Javascript vi Lua tren tic Ong cu 1#p trinh ph6 Bien vi dy nhu Xcode, Visual Studio, ho#c
Eclipse. Deng thbi no cho phip tic nhi phit tan game tren tic he dieu hanh khic nhau
vi chuyin sang tic nen tang khic khOng may kW. khan. Chinh viec h6 trq the nen ting cho
PC phuc At qui trinh xiy citing game, vsl khi Wing build cho 3 nen ling di dOng ph6 bien
'that dA to nen sot hip din c6a Cocos2d-X.
—Chi tiet cic nen tin h6 trq:
+ iOS 5.0 trh len cho tic trip chai iPhone / iPad
+ Android 2.3 tra len cho tic fro chai Android
+ Windows Phone 8 fro len cho tic fro chili WP
+ OS X v10.6 tra len cho tic trip chili Mac
11
+ Windows 7 tro len cho cac tr6 chai may tinh Windows
—La met enine ma nguan ma
Cocos2d-X hoan toan open source, ngutri sfr ding co the lam bit IcY dieu gi yeti code
tha no, vi cling co the deng gop vao framework neu de giup Cocos2d-X phat trien hem.
Cocos2d-X dugc xay dung hoan town bai cong deng phat then game, hoan Wan mien phi,
luen luon duce chinh sfra, phat trien, tom be ma nguan caa Cocos2d-X c6 the tai tren trang
chu cita Cocos2d-X.
—Cocos2d-X la met engine c6 hieu suit cao
Vai nen tang chit yeu huang den cac thiet bj di deng, day la yeu t6 hang dan ma met
Engine di deng can phai dam boo, vi thiet bj di dOng co rat nhieu can hinh khac nhau. Duce
xay dung tren nen tang d6 hoa OpenGL va ngon ngft lap trinh Javascript, Lua, nen
Cocos2d-X co hieu suit kha cao, chay dirge tren ca nhCmg thiet bj ciu hinh rat thap cua
Android. Dac biet dung lugng khi xuit file cai dot cho cac nen tang kha gen nhg so veri mat
bang chung cua cac Engine khk. Tren the nen tang di deng, Cocos2d-X td r3 lqi the cult
minh von de ttrcmg thich cao cho: Android, iOs, Windows Phone 8. Val cac nen tang nay,
game, ling dung yeti khoi hrgng a hoa don trung birth, chay tren ciu hinh di dOng tam
trung hien nay, c6 the dot dirge 60FPS — met con se kha cao ma nhieu engine khic kh6 c6
the dot &we.
—Da dirge kiem thing ben cOng dong
Tinh den thtri diem hien tai, co hang tram nghln game da dirge phat trien doa tren nen
tang Cocos2d-X trong de c6 nhung game n6i bat nhu Diamond Dash, Fishing Joy. 25%
game 2D tren store ctia AppStore va Google Play Store sir dung Cocos2d-X... Hien tai,
Viet Nam, kha nhieu thong ty cling dang sir dung engine nay trong do c6 nhieu ding ty
nhu GSN, Egame, Afoli...
—Nhieu cong co h6 trq
+ Engine vat ly: hai Engine thuong sir ding trong Cocos2d-X de me pheng cac
quy the vat ly trong game la Chipmunk va Box2D. Khi nhac den Box2D chung
to Idiong the nito kh8ng nhic den Angry Brids, Box2D cling deng thei cung cap
cac ham vat IY lien quan den gia t6c, t6c dO, trcong loc coa tn& d6i tugng de
ngtrei chai c6 cam giac giOng vii thus to nhit co the. Con Chipmunk mac dit
mei dirge phat trien Al day nhung ve tinh 'tang cling khong thua kern gi so voi
Box2D.
12
+ Texture Packer: c8ng co gifip gom nhieu Anti thanh min anti gOp phan lam tAng
hieu nang cho game vi thief 131 khong an xir 19 nhieu anh.
+ Sprite Helper: to cac animation (chuyen dOng) cho Sprite, tit dOng sinh code
cluing to chi can lam viec tren giao dien troc quan.
+ Titled Map Editor: Too ban do (man chap cho game.
2.1.2.2. So sanh Cocos2d -X yeti cac engine khcic
CO nhieu engineer lap trinh game di (long thong dung nhu Cocos2d-X, Libgdx, Unity
3D, Andengine... Ta co bang so sanh dac diem dm cac engine nhu sau:
STT Tlnh nang Cocos2d-X Libgda Unity 3D Andengine
1 Mien phi, ma x x Full version x
ngulin met phai tra phi
2 Dung luqng 1.5MB Khong co 8MB Khong co
game thong tin thong tin
3 HO trq 2D va 3D 2D, 3D 2D va 3D 2D
nhung chit nhung chi
yeu la 2D yeu la 3D
Da nen tang x x x Android
Nem ngO. C ++, Lua, Java C #, Khong co
chinh Javascript, Javascript va thong tin
Boo
TM lieu h6 Day dit Rat day du Day del, co Kh8ng co
trt7 nhung v6i Javadoc video huang tai lieu co
khong co (fan, co litI trq the
h6 trq
Tich hop x x
ding co dO
hoa
4 COng ding Tlit TM Rat tat TM
danh gid
Bang 2.1: So sanh gifra Cocos2d -X vet cac engine khcic
13
Dpa tren bang so sanh cho thay, Cocos2d-X kh8ng phai la cong cu duy [that va tot
nhat, tuy nhien day la cong cp phi) hqp nhat veri dp an dm tac gia a thOri diem hien tai.
Cocos2d-X c6 lqi the ve chi phi, neon nga lip trinh, dung luqng xuat file thap va tang th&i
ho trq da nen tang. Mac do khong c6 ho trq tir phia nha cung cap nhung nhiing thong tin ve
Cocos2d-X duqc cong clang chia se kha day dir, c6 nhieu tai lieu tieng Anh de tham khao.
Vi vay tac gia quyet dinh kra chqn Cocos2d-X la engine de thpc hien dp an.
2.2. Kiel' frac tang quan vi m8i trterng lim vi4c
2.2.1. Ca cJu ti char this- mite
Name Date modified Type Size
I jc cocos2dx 11/211/201.3 1011 ... File folder
CocosDenshion 11/28/2013 10:11 -. File folder
document 11/28/2013 1011 ... File folder
k &tensions 11/28/2013 1012 ... File folder
k eternal 11/28/20131012 ... File folder
la licenses 11/28/20131012 ... File folder
ji Plu9in 11/28/20131012 ... File folder
ja samples 11/28/20131012 ... File folder
saiPtift9 11/28/20131012 ... File folder
5 template 11/28/2013 1012 ... File folder
5 tools 11/28/20131012 ... File folder
•Riciftre 9/26/7913 913 AM Text Document 3 KB
.gitmodules 9/26/2013 913 AM Ted Document 1KB
LJ •travis.yr1 9/23/2013 1918 AM 'ML File 210
AUTHORS 9/23/2013 1918 AM File 17 KB
build-nadsh 9/23/20131018 AM SH File 1KB
build-win32.bat 9/23/2013 1018 AM Windows Batch File 3 KB
LJ CHANGELOG 9/26/201310:41 AM File 73 KB
cocos2d•win32.vc2010.sln 9/26/20131041 AM Microsoft Visual S... 13 KB
cocos2d-win32.vc2012.sln 9/26/201310:41 AM Microsoft Visual S... 13 KB
cocos2d-wind.vc2012.sln 9/26/2013 913 AM Microsoft Visual S... 18 KB
cocos2d-wp8.vc2012-sln 9/26/2013 9.13 AM Microsoft Visual S... 16 KB
Hinh 2.2: NO1 dung tep tin IDE sau khi gidi nen
14
Cocos2d-X Nai chira toan be dc ther vien chinh ma Cocos2d-X cung
cap
Cocos6reeshiorC:c: Chose this Wen, tep tin da phuomg Hen nh
am thanh va ill
Extensions Cung cep cac this vien Oat trign ve GUI, cac this vien kgt
naafi mang then 2 kigu chinh la HttpRequest va socket.
Cho dc thv vi A (a5 2 thirvien Vat l chtnh
sus dung trona -X la Box2d va Chipmunk), cac this
vien ha trot 3D
Sample Chita cac dv an miu.
Bang 2.2: Co clu to chirc this myc trong Cocos2d-X
2.2.2. Kiln tree Cocos2d-X engine
\pplicoion
S,
Platform Laker Platform Lacer 1r.
III IIIII
Hinh 2.3: Kiln frac Cocos2d-X
Cocos2d-X dirge chia thanh 3 tang chInh: Ting ting dung, tang this vien va tang he
dieu hAnh.
a. TAng img dung: la tang china cac (mg dung dirqc phat trien bed IAp trinh vien, cac nhi
phit trien phAn mem. Ngoli met s6 (mg dung duqc Android tich hqp sin nhu email,
15
SMS, trinh duyet web, danh be... thi ngutri dimg ci the a ding cli dat them cac 1mg
dung tit Google Play hay cac chq (mg dung khk.
b. Tang thu vien: Day la not chin cac 1)0 cac thu vien xay dung nen cac chile nAng chinh
cia Cocos2d-X. Trong tang nay duqc chia thanh 4 nh6m chinh:
—Graphics: chin thu vin do hoa. M6i mat khung hinh, Cocos2d-X se ve lai anh len
man hinh bang OpenGL (d6i v6i windows) hok OpenGLSurface — phien ban thu
nh6 cua OpenGL giip giam mirc dO tieu hao ning Itrong va tang hieu nang cho
thiat bi smartphone (tren thiet 1)1 smartphone).
—Audio: Thu vien ma rang ding de thuc ...g de dim bao an toan thong tin nguai dimg.
Cie yeu au dtic biet khic
Can co kat mai mang khi thuc hien cac you au teoi Server
38
Giao dien minh has
You must login before exam
Hinh 3.2: Man hinh clang nhap
3.4.3. U0103: Bang 10 tai khoan
UC #03 Ding 4 tel khoin DO phut t;p: 2/5
Chirc nang nay cho phop ngulyi dAng ding ky met tai khoan mai
Mo ti de sir dung chucmg trinh. Sau khi c6 tai khoan ngueri ding co the tien
hanh ding nh#p va su dung cac chirc !tang khic dm he thting.
ChInh Ngutri sir dung
Tic
nhin phm Kh6ng cif)
Tien (lieu kiln Chucmg trinh phai duqc khai dOng binh thu?mg, phai co ket n6i mang
Iii khoan mil duqc dang 4, ngubi citing co the sir dung tai
Htu Thlnh
khoan nay de dang nhip.
dial cang
kiln L61 TM khoan men khong dirge ding k9, du lieu kh8ng bj thay d6i
39
Su dO tang cong viec
Hiin thj man
Bat dau hinh Rang k9
Olen thong tin tai
khoan mat
Girl thong
Man nut "Bang tin too tai
kr Moan
Nhan nut 'Huy Kit thtic
Sc (14 3.4: So. da hciing cong viec "Dcing
40
Se 46 trinh ti
Son
--(..-...) 0 CD 0
I: awn ducnong ding kyo • :
1 '
2 ittinjhi 'rang dam; Icy()
3; Nhap thong tato 1 +
4 : Nhan nut de dam Icy0
5 :Thor hien clang
: Tao dol telt
7: Gul thongdoi
Luu vao CSClit
blhong bao ket casa()
10 :7bong bap ket q.aa)
F : hien It ket am &rya kV(
Sc clii 3.5: Sc coo trinh tz, "Dting Icy"
Phirang phip thyc hien
Nguiri mi dyng
Ngirtri clung se lien hanh nhap ck thong tin sau:
— Email
— Password
Sau khi dien day do ck thong tin, ngtkri dung se ham vao nut "DAng Icy" Mac
"Register". Neu clang 1c9 thanh ding, chtrang trinh se tit ve man hinh clang nhap. Neu
clang Icy kh8ng thanh Gong, chucmg frith se hien th8ng bao va nguiyi dimg se nhap thong
tin tai lchoan khk.
Neu muOn dimg viec clang k9 vi tra vi mini hinh clang nhap, nguai dimg se barn
vao nut "Hit)," hoac "Cancel"
Chuang triith x* 1f
Sau khi ngtrai dimg nhap day di thong tin va barn nut clang 14, chuong trinh se
lam nhfrng °Ong viec sau:
— Kiem tra ring bubc dr client(Dimg djnh dang email, password...)
— Lay ra ck gia tri ngubi dimg da nhap vao
41
— MA hea mat khau bang ham bAm met chieu MD5
— Sir dung HTTP Request theo clang POST truyen goi du lieu tren den Server
— Nhan ket qua tra ve tir server
— Thuc hien phin Nil cho ngutri dung
Twang hqp clang 1(9 thinh cling, chucmg trinh se hien thong bao "Hang lcy thanh
eating" deng th&i chuyen den man hinh clang nhap. Neu server tra lei la clang nhap khong
thanh ding, chucmg trinh se hien thong bao cho ngtrai dung va yeu cau ngtrei clang nhap
lai thong tin.
Server
Sau khi nhan duqc you cau Clang 1(9 tir client, server se tien hall cac cong viec sau:
— Phan tich you cau tir client vi lay ra cac gia tri:
+ Email
+ Password
— Kiem tra xem ten clang nhap da ten tai hay chua. Neu ten clang nhap dA ten tai
thi tra ve cho client ket qua clang k9 that bai
— Neu ten dAng nhap chua ten tai, Server lien birth them mod ban ghi vao ca se
dU lieu. Cac bang User se duqc 4p nhat:
+ Email: Ten clang nhap cita nguei dung
+ Password: Mat khau clang nhap
+ RegAt: Thei diem hien tai tren server
+ Latest: Thiri diem hien tai lien server
+ HighScore: 0
— Sau khi them ban ghi thanh cong, server tien birth tra ket qua thong bao viec
Clang k9 thanh cong cho client.
Cac yeu au dtc bi%t Idnic
Thiet hi can duqc ket not mang de tien hanh giao tier) voi Server
42
Giao dien minh hip
4
. ,
EMIt
'OMNI
frAltWORD
flinh 3.3: Giao din citing ki
4
1116121441MILCOM
Check password again1
Hinh 3.4: Giao dien clang 10 vit thong btio
43
3.4.4. UC#04: Kane Ira plain bdn vd ejip nisei da lieu
UC #04 Kam tra phien bin vi cep nhet de lieu DO phut tap: 5/5
Day la cling viec chuang trinh thac hien mat cach to clang miii
khi ngueri dung kheri clang chuong trinh va co ket not mang, khong
yeu cAu thao tac !lac) tir phia ngtreri dung. Chirc nang nay co nhiem vu
Me ti kiem tra phien ban Tang dung va phien ban du lieu hien tai dm ngueri
dung. Neu phien ban hien tai khong phai phien ban meri nhAt, chuong
trinh se Wen hanh cap nhat der lieu med.
Chile nang trong chuong trinh
Tic Chinh
nhan Phu Ngutri clUng
Tien dieu Idea CAn có kelt not mang
Diu Thenh CO nhat them mai du lieu trong b# nher dm Client
di& cang
kien Lai Khong có thay dei du lieu trong b0 nher dm Client
44
So. d6 luting cling vi§c
User Smart phone Handling
( BM diu)
4,
Kheri dOng Hien thl man Nem Ira kid ned
chinng VIM hlnh loading mang
Ksim tra version
$
Hien thl vi cep Tai dirt riem
d nhet progress
Thong bao thinh Ghi dD Ku
cOng xuang be nh&
KAI 'Mk
So. dd 3.6: Sa do fusing cling viec "Kilm tra phien ban va cap nha't die' lieu"
45
Sit 46 trinh ttr
0 0
. S S
itariathel _atm
1:: Kiwi done chuong trathd
2114:Zink Firth loack•O
4 : Yey cau kien ira ket rid rnant)
quiraacteinnAgtigong0
5 ,Tra le ari yeu cau check Yera000.1 ?
• U
7 :jit ye ket qua chedc wain
8 yeu cau download ts0
9 : Igen thl vatai allot progress download() i
.7 I •: GU data()
11 Ma- vao loo nhotj
: Ill • ban Ivan tat qua Din h • • 1,11 • • 0
Ili
So. cili 3.7: So. do trinh ty "Krim tra phien ban va cap nluit clii lieu"
Phirong phip there hien
Chuang trinh xi If
Cong viec nay you cau giri-nhan ket qua tir server va xir 1S, logic trong thoi gian
suet thiri gian thuc hien cho nen can phAi sir dung 2 luEng.de tien trinh hien thj giao
dien lchong bj treo trong khi thuc hien logic. Cfic cling viec chucrng trinh can thuc hien:
— Giri yeu cau ten Server de check version
— Nhan ket qua checkup version dr Server
— Gin you cau download data
— Nhan data duqc truyen tir Server
— Ghi data vao bel nha
— Hien thj phan tram download tren thiet bi
Server
46
Server se ling nghe you cAu tir phia client va tra ve cac ket qua theo yeu eau tir
phia Client.
Cie yen an tric bitt khic
Can do ket n61 mang khi thuc hiOn cac you dm va nh#n phan h6i tir Server
Mao diOn milth hya
• •
0 Of
Hinh 3.5: Giao then khi Mei dray zing dung
3.4.5. UC#05: Teo de bid via cau hoi trek nghtent
UC #05 To di bli va ciu hal tric nghiem DO phirc tam: 3/5
Khi ngueri dung thao tac chip the lo4i de luyOn t#p hoAc thi Mfr.
Chuang trinh se gqi den chat nAng ma nguari dung Mang tac. Tuy
M8 ti nhien cac chic nAng d6 duqc se to dung gqi den chic nAng nay de
kberi tao MI liOu. Chic nAng nay IA can thiet va co the coi la nen tang
hay chinh la tinh ke thira trong 1#p trinh huerng cthi tucmg
Chic nAng LuyOn t#p/Thi TThu
Tic
shin p s Khong co
47
Tien dieu kiln Chuang trinh phai duqc ;chili dOng binh thirimg
Hu Thbah Hien thj de bid va cau hoi tric nghiem
congfing
kiln Lid Ithong co da Ro
So' la luting cong vilc
Database
Function Lisa Smart phone Handing Chant
( BAt du )
I .
4
Gtai thd IG6m tra di)
: d bithd Iosi cd to 440Ip)Oe•
/ 4kb) a / .
an tao %kh eing
•
i
Kw too 1191u
Side di bill ve
dm hdi Irak
isaNdm c6 wag
CSDL
Die rat at cau
! au hail Ink /
trd RA
tan thi dli bid taro lei au tri
ifri Inio bo nhdr
Chan dip de 4— II cau ha Irk 4--
ntitedin lent
Wake tni kat qui
Gal Dive
lit ma di
chOn va
dip an
dm kw a
Min tad tblp in H Ell ehtrtem
K these )4 — dichitin vii hat X i) It Icid dud kk kilt
( qui
So' dá 3.8: Sc coo hieing cong viec "Too de' bai va cciu hoi trcic nghifm"
48
So dil truth hi
isminbilm
.
41 Took
, Ki) 0
s siltict .i.aanign
1: as chu de and Lao° on: 2 :10em Ira chu deco ton tal
1-1
3 : to de bai theo do de()
5 :baa tat lucau • Tao dc4
6 : GU dal Una°
7 : 4 thi de bat vi, cau hai frac • -`f
2 : Chan dap an 1
9 • - C an da anon • • hay aaip
1 1 : Hen ei dap anq
So. da 3.9: Sa cla trinh to "Tgocij bat va cau hot trot nghiem"
Phirong phip thyc himn
Chuang trinh xur If
— Nhan chit de can tgo tir tic than gui din ten
— Kiem tra xem cif) chi a d6 trong CSDL tren may kh8ng
— Neu khOng: thong bio du lieu chua c6 tren min hinh cim ngueri dung, ket thic
chirc nang tai day
— Neu c6: se thy ngau nhien mOt de bii theo chi de tic than gfri tea ban du.
— Chucmg trinh se dio tat tit cau tri Rd, vi gin lai gia tri dap in van b0 nh6 tam.
— Hien thj de bli vi du h6i tric nghiem tren min hinh
— Ngueri dimg chon eau tra Itri cia minh
— Chuong trinh so sank cau tra Rd dm ngteri dimg vi dip In vita hm trong b0 TIM
tam
— Hien thi ket qui vi dip in ngtrei dung da chqn len min hinh. Neu ngueri dung
chon ding, chucmg trinh se c6 nhac bio "Tinh tinh" deg thin din miu nen mia
dip in d6 sang mitt xanh li cay, ngtrqc lai se boo "Teeeeee" demg thin dOi mitt
49
nen dap an ngtreri dung da chin sang mau do, mau nen dap an dung sang mau
xanh la cay.
Cie yeu ciu dOc met kink
IChong c6
3.4.6. UC#06: Luyen 42p
UC #06 Luyen tap DO phut tap: 3/5
Chirc fling nay cho phep ngu&i dung chon chit del de luyen tap.
Sau khi lua chat.' chi" de, chuang trinh se gal den chirc nAng tao de
MB ti bai de lay than be der lieu theo cho de ngtreci dung &A chip va hien thi
nil dung a bai de ngtrai dimg luyen tap.
Nguai sirdung
Tec Chfnh
nhan Phu UCO5
Tian dirk kiln Chuang trinh phai duqc khai ding binh thuang
Hien thi giao dien chirc nang luyen tap va cac tuong tac host
t
:
t 0
o.,o ThInh
?IS
0
u cling ding binh thu?mg
440
:2
0
L8i !Chong c6
50
Su a tang ang viec
User Smart phone Handing Function API
(sings
1 Gdditi
Ction chd 06 tAydoiud4
cau h61 trlic
luyen t$p NI Moo dui de 1
0910Orn
hr
4
Hien rhI the:" tin
Nhan nit ciwydn Lay de Ku dr Lou via In) nh6
de Uri va cats Mi nit rem tern
au Sep the° tree nghlem
h) bit qua
Hien IN dip an
Chi* dlip an Fa st • dip an di chip
chin Wm Sal
Hien thi kat qua
NMnniltBack 4 a thong bao •
nhec di kern
Kit thdc )
So. d 3.10: Sc dO luting cong viec "Tgo dJ bai theo cha d'J dci chpn"
51
Su dó trinh tn.
1-
0 souk
-"khan chuck can luyen .
eu eau tao de bar theo dlirlk0
3 : Gt, chu de chn tao de lay date°
:' 1111
-11 va° bcbrihcl de t 4: Tao dotheing()
4 0
6 : He np de bat va cau hal trac
71thandapanO
8 • Cap 4111 Irargi thai dap an da chant
LA Yeu cau xu ly dung sago
10 :Kee tra dap an()
11: teen thi dap an va Neu 0:190
Lrill
Chuyen cau ben theok :
1j3 : Lay du btu tong bo ri
14: trthi de bai va cau hoi trac
1.5 : Nhan nuteadd)
16 : ' drop chuc nang0
Sa ad 3.11 Sc ad trinh ty. "Tgo td bai theo chti de da chon"
Phtrung phip thyt hien
Ngtriri sfr dung
Sau khi chip chu de tie luyen tap, chuong trinh se tai du lieu len man hinh ciia
ngu&i dung. Tai day ngueri dung c6 the ca the thao tic sau:
— Chan dap in.
— Chuyen cau tiep theo
— Quay lai giao dien chinh
Chuang trinh milt
— Sau khi nguai dung chin chi* de luyen tap. Chuang trinh se pi den chile nang
tao di bai va cau hoi tic nghiem (UCO5) de khai tao va Itru vao hi) TIM tam.
52
Sau da chuang trinh se hien thj len man hinh ni)i dung de bai trong trang giao
dien caa chirc fling luyen tap.
—Sau khi ngtreri dung chan dap an. Chuang trinh se lciem tra dap an da chan vai
cau tra 1&i duce luu trong be 66 Lam. Neu Wing se c6 tieng "Tinh tine, neu
Sai se c6 tieng "Te" va thing th6i hien till dap an Clang bang hinh
—Sau khi ngtrai dung chuyen cau tiep theo, chtrcmg trinh se lay titp 1 de Hi khic
da duce luu trong ha' thief tam
—Sau khi ngtrai thing chcm chic nazi); Quay lai giao dien chink. Toan b4) du lieu
duqc luu trong b0 nha tam se dirge gig phUng, deng thth chucmg trinh se chuyen
ve giao then chinh.
Giao dien minh hos
53
0
Claim 1: hesthopurporaftherwal
Hinh 3.6: Giao dinbai dung van ban va eau hot mac nghiem sau khi lay du lieu tit
CSDL
0
Gaol Itotsikepoparoliletreol
S
Hinh 3. 7: Man hinh hien thi dip an sau khi fly:6i dung chon dcip an chinh xac
54
Galion 1: S aid doom aster
Hinh 3.8: Man hinh hien thi de bai dan$ am thanh kern hinh anh va cau hei trot
nghiem sau khi lay dir lieu tit CSDL
0
Question 1: S ad door one
Hinh 3.9: Man hinh hien thj dip an sau khi nguiri &mg dun; dap an bi sai
55
3.4.7. U0107: Thi thtt
UC #07 Thi thir DO phfrc tap: 3/5
Chuang trinh se tao ra mot de thi c6 cau true gi6ng deng then
tinh th&i gian lim bii. NOi dung de thi ce eau true gi angf vei de thi
Toeic hien nay g6m 7 phan Luang img vai so Wang cau m6i phlin
MO to trong d'e thi Toeic vi then gian lam bii li 120 phut. Ket thic bai thi
nguiri dung se biet diem mirth ngay1ap tirc vi c6 the xem1ai bii lim
c6 hien thi ket qui Dimg/Sai.
Nguiri sir dung
Tit '• Chfnh
nhin Phi) UCO5
Tien dieu hien Nguai sir dung can phii Bang &fop vao he thting
i 0104
0 Thhnh thi thir co du true gi6ng vol de thi Toeic hien nay
Tao ra mot de
6
4) 4 cam
0
:2
40
Kh8ng c6
56
So d iang ding viec
User &nett phone Function API
sk Mu
Olen di) de
nein 1PP
Cheek thin ceu
Ithic
Chen eep en
then nig Submit
Whin net Beek
1
Sc da 3.12: Sc chi luting cong viec "Thi this."
57
So. d6 trinh
SEM
ante mg IN et ;
3: 11011 05elegeltrua
rill' a bedanlin • te ,eu go 50 et te r- Mtge
. • II
:Ta teOg a
ray tombs= rag. - -Heel deal
P
•
I : Tao dd terea
e am to we eep D
Irtar go stg 10 dm MI qp-w map 1
: Te Unk
rarkdalea; Nag
• tee)
: Lu ce to mie ;
: -Si O de le am Ig 00Q
Ta tereallij
rti_Ctlegteggai
go 46 It Mg olso vs0
Tam 0v0
t ce Id Inc aitinal
To Sava
Le ea le a Sc
'aeons 24•403.
: Tit as tmi 01100u
E: Ye g On to le V aga
: dos MI 101 Snail j
So do 113: Sa coo trinh to "Thi the."
58
Phuang phaip thwc hien
Nguivi sir thing
Sau khi chon chirc nang Thi the, chuang tranh se tai du lieu len man hinh cea nguai
ding dOng then tinh then gian litm bal. Tai day ngtrei dimg di the ea the thao tac sau:
— Chan dap an.
— Chuyen eau flip theo
— Hoan thanh bii kiem tra khi chtra het gib
— Quay lai giao dien chinh
Chuang trinh zit If
— Sau khi ngueri thing chirc nang thi the. Chuang trinh se gqi den chile nang tao
de bai va cau heti tic nghiem (UCO5) de khoi tao va luu vao bQ nher tam.
Chuang trinh se sir dung nang Tao de bid vi cau hei frac nghiem 07 tan veri thir
tu nhu sau:
+ Tao ngau nhien 10 de bai veri chit de: "Nghe — Ti tranh"
+ Tao ngau nhien 30 de biti voi chit de: "Nghe — Heti dap"
+ Tao nglu nhien 10 de hal vei chit de: "Nghe — Hui thoai"
+ Tao ngiu nhien 10 de bli veri chit de: "Nghe — Doan thOng tin"
+ Tao ngau nhien 40 de Hi v6i che de: "Dqc hieu — Doan thanh cau"
+ Tao ngiu nhien 4 de Hi yeti che de: "Dqc hieu — Hoin thanh doan van"
+ Tao ngau nhien n de Hi yea chit de: "Doc hieu — Tra leri cau heti" sao cho
tong so cau h6i frac nghiem la 48 du
+ Luu 5r: m6i cau hei frac nghiem sau khi tao ra duqc danh s6 the ttr tang tiep
eau twee. S6 bit d'Au tir 1.
— Sau khi ngueri dung chop dip an. Chuang trinh se luu lai dap an dA chqn vao b0
nhe tam dung de cham diem sau nay.
— Sau khi ngutri thing chuyen du khic, chtrcmg frith se lAy de bai co eau heli img
voi so thu to du dtrqc luu trong NI nhe tam
— Sau khi ngued thing chip chirc Ming holm thanh bii thi, chucmg trinh se idem
tra ket not mpg dring then tao mOt flan trinh khic tien hanh chAm diem vi thong
bao diem cling nhu ket qua cac dip an cea de bai cho ngtrei dimg. Neu ket qua
59
kiem tra ket not man la c6 chtrcmg trinh sE girl diem le'n Server de xfr ly ngtrqc
lai lien trinh nay se hi buy bet.
— Sau khi ngutri dung chip chfrc nAng Quay lai giao din chinh. Toil .% N du lieu
duqc luu trong b0 rilie tam se duce giAi phi:mg, ding thei chtrcmg trinh se chuyin
v'E giao din chinh.
Cac yen au d$c biet 'chic
Khong c6
Giao dien minh hya
60
119:91
0 =D
anon 1: talen rd dinar wan
Hinh 3.10: Man hinh sau khi vac) char nang thi this.
11r - 4
QUFTTION 75. C
QUESTION 76:
QUFTTION 77: P
QUFTTION 79: 8
QUESTION 79: P
QUESTION Al:
QUFTTION
QUFTTION 91:
QUFTTION 94 :
QUFTTION 95.
QUFTTION
Hinh 3.11: Man hinh hiern danh sach cac aiu hot trong chac nang thi this.
61
Hinh 3.12: Man hinh hiAn thi kit qua thi thzi sau khi hoan thank bai thi
62
CHUUNG 4. THIET ICE VA TRIEN KHAI UNG DUNG
4.1. Kien true he thing
Ting thu vien
Ting Androi
Ting giao dien
Tin,g then khain Ting platform
Ting de lieu
Ting IOS
t
Ting CSDL
Hinh 4.1: Kiln Ink he thting
ling dung "Luy'en thi Toeic" duqc xay dung theo kien true phan tang duqc cai tien tir
mo hinh MVC, duqc mo hinh nhu ten:
—Ting thu vien: la tang cung cap cic thu vien duqccung cap tir Cocos2d-x ve cic
thu vien ma rOng do tic giA dinh nghia. Tang nay giao tiep mgt chieu ten tang giao
dien nhim cung cap cic lap va phuang thuc lien ich yeti row dich chinh la tai sum
dung.
—Tang giao dien: la tang cung cap cic 16p giao dien, c6 nhiem vu chinh la than
tucmg tic, giao tiep va xi. 19 logic tir tacmg the dm ngu&i dimg. Tang nay duqc giao
tiep hai chieu vtri fang dieu khien de than vi truyen dD lieu.
—Tang dieu khien: la tang giao tiep gifra tang giao dien va tang oar lieu hoac giCra
tang giao dien va'tang Platform. Tang nay se glop truy xuAt du lieu theo you du tir
tang' giao dien, hoic gfri/nhan yeu eau tir tang platform.
—Tang rift lieu: la tang giao tiep giCra tep tin du lieu va tang dieu Wen. Tang nay
nhiem vu doe der lieu tir tep tin da lieu c6 cau frac JSON, sau d6 phan tich da lieu
va tra lai dry lieu theo you du tir tang dieu khien.
—Tang co s6 dft lieu (CSDL): la nai luu Uri dft lieu ten Server va ten Client. Co the
nhu sau:
63
+ Server: Nha cung cap (NCC) se nhap dft lieu de bai vao he quan tri CSDL
MySQL. Sau d6 NCC se sir dung nen ngti Server PIS de tao dCt lieu theo can
trite JSON luu thanh tep tin "allDatajson" tren Server.
+ Client: Nguai sir dung (NSD) sau khi kh?ri dOng chuong trinh, chuong trinh se
to dOng tai ve tep tin da lieu "allData.json" va phan tich de tai them the tep tin
hinh anh va am thanh chua co trong be nher may.
—Tang Native: la tang dinh nghla cac ma nguan c6 the sir dung chung duce tren cac
nen tang
—Tang Platform: la tang nhan dinh de dieu lchien gifta tang Native van cac nen tang
IOS hoic Android.
+ Tang Android: Chira ma ngu6n cua he Alien hanh Android
+ Tang IOS: Chira ma ngu6n cua he dieu hanh IOS
4.2. Thiet ke chi Het chat ning thi thir
Is*
CannINgiss "stjaWilat aart
.ttbNS Caimbelpiet Cemodran
blthor COSalSpis Ana tears
NOmp a.
!Ms* (Oatalffsa ApeinitOwn
pulthdaspi TSIOIONIS
dsdrilig)
ks* Twic
ant Thig...bni) 1.1
Ow eilotiamer IS odble/aCiTysi .--
Mop Ma"
ti enesiQuiria ...oh slain
..S.a041010.0
ft_rofigilagar celbnesidebesitair kat
Ils_MAIINet 7
raffiacola
Pktddelt COSthaipis
raislIek COMpIrdpis
Seiniallogr StwarcQtatithae
:::).="") cchog..+41044)
Pars
44446.+NaCk4464
• As igesi • 4
ambryslressfra30 at 5.•
ava6>Seadert40:04•0 ■
Owlylair -•••c* Aga
..uomegfte 41.1
4 • ' >tkalget
n wit•kilsedt Mart) det.>WMEM4
oUttohis) at klis".•4
et4ato3/41friebk altaIrstalst
olne011istAwne0 ===
nibnasesftwedi COMWO
«.d6NpTS.b(t iD aranOmile 4 =6
,apaialeskamlaspiebsehairalkainp(qemiND
“witoftellutialcbrok WNW adb>e0
exilitaftelkiclatral) ..is selameadr ONS Swim WIS.
tmitotailaistatberai CC 444.S•44)
010) asininneet
apilikdbMI) aSnisaislatTabsilAds abeci•)
<beate-igasil7ffic0 anneMe0
axwitsesILISO diers~.00
OICeliapienylanOWNSIO il0
C4C)111T<SigraMPEBACII411161•1110
<Ositealdb101110•10lat
<4443rieplabillig044Qoplatle
Hinh 4.2: So JO lop chi tilt char Wing thi ante
Mo ti
Sau khi dic to yeu cau cac chirc nang dm he tilting, tac gia dua ra duqc so di) lop chi
tilt dm chic nang "Thi thir". Chirc nang nay dtrqc thiet ka bed cac kip dei tuqng sau:
64
- Topic: Day la lop thuOc tang giao dien, ce nhiem vu hien thi du lieu de bai (nOi
dung down van, Milli anh hay tep tin am thanh) vi xi' 19 twang tae dui ngu6i dung.
- TopicContent: Day 11 mOt kieu du lieu do tac gia dinh nghia, dimg de d6ng gel der
lieu tir cac kieu di: lieu nguyen
- MCQ: Nhu da dAc to yeu cau a chtrcmg 3, chirc nang "Thi the duct ke thira tir
chirc nang "Tao de bii va cau hoi tic nghiem". Lap nay thuOc tang giao dien, thy
nhien de tang toe dq xir 19 cling ram giam thai gian build (xay dung cac ban cac
ban a milli nen tang), 16p nay con c6 nhiem vp xi: 15f logic cac tuang tic vela ngueri
&mg. Giao dien 16p nay dtrqc chia that'll 2 phan chinh gem: giao dien lap Topic
va giao dien cau hei tic nghiem (chira not dung cau h6i, dap an, cac nut ttrcmg tac
chuyen cau va quay Lai giao dien chiral).
- ConfigLoader: Day 1116p thutjc'tang du lieu, c6 nhiem vu phan tich dir lieu va cling
cAp cac phuong that a thy cm Ru.
- Questionitem: Day la 16p thuc the, chin cac thuOc tinh can thiet de tao cau hei tic
nghiem, lop nay cung cAp 2 phuong ditic cai dAt va !Ay du lieu cho m8i thuOc tinh.
- FullTest: Day la 16p cluqc ke thira tir lop MCQ, lap nay c6 nhiem vu chinh la khei
tao de thi vi lAy du lieu tir ding du lieu .
4.2.1. Topic
a. Phuong thirc
- Bool initO;
1' nghia : Phuong thac nay dimg de Ichei tao giao dien
- Static Topic* create();
Y nghia : Phuong tithe c6 nhiem vu tao doi tucmg Topic
- Void onBtnPlay(CCObject *obj);
Ni" phuang thirc co nhiem vu nhAn Wang tic tir ngtari dimg vi xir 19 logic sau
khi nhan nut Play tep tin am thanh tren man lfinh Void updateStnState(CCObject *obj)
- Void updateContentTopicO;
de bai
ngl ►a: phuong thirc c6 nhiem vp cAp nhAt nOi dung
4.2.2. MCQ
a. Phuong thUc:
- Virtural bool initData() = 0;
65
• nghia: Day la lap thuan lo, cac 16p ke thira tir 16p nay buOc phai dinh nghia lai
phucrng thirc nay. Phucmg thirc nay co mvc dich khai tao toan bq aft Ro can thief de luu
tra trong b6 nha dem (du lieu duqc luu vao mOt vector, vector se tv dOng giii phOng b0
nha khi thoat khei chile nang nay).
—Virtual void onAnswerClicked(int id) = 0;
• nghia: Day II lop thuan lo, cac 16p ke thira tir 16p nay buOc phai dinh nghia lai
phucmg thin nay. Phucmg thirc nay co mvc dich xir 19 logic sau khi ngtrici dung chqn dap
in.
—Void pushQuestionID() = 0;
• nghia: Day la lap thuan lo, cac 16p ke thira• tir lop nay buOc phai dinh nghia lai
phucmg thirc nay. Phucmg tithe ply c6 mvc dich day du lieu vao b0 nh6 tam.
—Void onAnswerClicked(CCObject *obj);
nghia: Phuong thirc co nhiem vv phan tich xem ngutri dung da chon dap in nio
—Void loadQues(int id);
nghia: cap nhat du lieu de hal vi cau had frac nghiem img vtri tham so truyen vao
la vi tri chi s6 thin tp duqc luu trong b4 nhe dem.
—void onPushDataO;
1.1 nghia: Nap them da lieu vao b0 TIM tam
—Void onClose();
nghia: D6ng lai chic nang dang sir clang, quay lai giao dien truck do.
—Bool initO;
nghia: phuong thirc nay dimg de Ichai tao giao dien
—Void loadText(CCLabelBMFont *lbl, std::string text);
nghia: cap that niji dung doan van ban yen tham s6 truyen vao la ddi tuqng can cap
nhat (*lbl) va On dung doan van ban mai (text).
—bool showAnswerO;
nghia: kiem tra dap an ngutri dung da them et) dung khong. Neu dim tra ve gift ti
la "True" nguqc lai tra gift 14 "False"
—void gotoQues(int id);
nghia: nhay den cau hei nao de v6i tham so truyen vao la vi tri cau h6i trong 130 nha
dem
66
—int getTopicIDByQuestionID(int questioniD);
Nit nghia: lay topiclD theo questionID yeti tham s6 truyen vao la questioniD
—int getTotalQuestionInToPicByQuestionID(int questioniD);
nghia: Lay tong s6 cau heti ce cong topic yeti tham s6 truyen vao la questionlD
—void pushAllQuestionDataInTopicFrotnJsonToDataTemp(int questionlD);
nghia: Day tom b0 dU lieu c5 cimg de bai WA de bai cua questionlD duqc truyen
vao
—virtual void onBtnNextClicked(CCObject *obj);
nghia: Xir ly chuyen cau tiep theo cau hien tai
—virtual void onBtnBackClicked(CCObject *obj);
N/. nghia: Xir IY quay lai cau tram cau hien tat
—virtual void onBtnSubmitClicked(CCObject *obj);
nghia: Xu ly hoan thanh bai thi (d6i vbi chirc nang thi alit)
—void updateStnStatusO;
Ntte nghia: Cap nhat tinh trang ck nut sau khi chyn dap an hoc chuyen sang cau h6i
tic nghiem khac.
—bool isChangeTopic();
nghia: Kiem tra xem viec chuyen cau hen c6 thay d6i de bai hay khong. Neu c6 tra
ve la "True" ngugc lai la "False"
—void sortData( Questionliem &qsData );
nghia: Dao tat tir dap an trong cau hei
—std::string getAnsByKey( Questionitem data, int id );
nghia: phucmg thirc nay hit try cho phucmg thirc "sortData" c6 nhiem vy lay dimg
di lieu sau khi dao tat to dap an
b. Thu0c tinh:
—CCMenultemSprite *m_btnNext: dung de ye nut chuyen cau hei tiep theo cau hien
tai tren man hinh ngubi thing
—CCMenultemSprite *m_btnPre: dung a ye net chuyen cau Wu& du hien tai tren
man hlnh ngutri dimg
67
—CCLabeIBMFont *IblWaming: dung de hien thi mOt down van ban nh&c ngutri
dimg.
—int quesIndexInTopic: km s6 thin tv cua cau hoi hien tai trong danh sach cac cau
hoi thuOc de bai nao do.
—Topic *mtopic: dung a dieu khien cop nhat de bai
—CCLabeIBMFont *m_lblQues: dimg de hien thi neri dung cau hen
—CCLabeIBMFont *m_lblAnsA: dung de hien till nOi dung dap an A sau khi dio treat
to cau
—CCLabeIBMFont *m_lblAnsB: dimg a hien thi nig dung dap an B sau khi dao treat
tv cau
—CCLabeIBMFont *m_lblAnsC: dung de hien till nOi dung dap an C sau khi dio trot
ty cau
—CCLabeIBMFont *m_lblAnsD: dung de hien thi nOi dung dap an D sau khi dao trot
tv cau
—std::vector m_vDataTemp: dung a tau tra cau hoi trong b0 nher
tam
—bool m_isShowAnswer: dung Idem tra co hien dap an sau khi ngutri dimg chon
dap an hay khong
—int m_currentQues: luu vi tri chi s6 hien tai cim cau hoi trong danh sach cau hoi
ducrc luu trong b0 nher tam
—int m_questionLastChange: km vl tri chI s6 cau h6i vira xem gan that trong danh
sach cac can hoi dugc luu trong b0 nher tam
—int m_totalQues: luu king s6 cau hoi trong chirc nang
—CCMenu *m_pMenu: chua danh sach cac nut
—CCMenultemSprite *m_btnSubmit: dimg de ve nth hoin thinh bai thi tren man
hinh ngutoi dung
—CCMenuItemSprite *m_btnBack: thing de ye nut quay lai giao dien tusk de curt
ngu6i dimg, ding thbi se giii ph6ng toan b0 b6 nher &Km sir d‘mg cho chirc nang
nay.
4.2.3. ConfigLoader
a. Phucmg thirc:
68
—Static ConfigLoader* getInstance()
nghia: fra ve singerton cua doi ttumg ConfigLoader
—Void loadLookupData()
nghia: doe va phan tich du lieu tir tep tin dii lieu co djnh Bang JSON da ducc tai ve
may.
4.2.4. Questionitem
a. Phuong thfrc:
—Void setter( value)
nghia: cal dat gie tri co kieu dii lieu img voi kieu dii lieu clia thuOc tinh dtrorc cai
dat.
— getter()
nghia: liy gia tri cua thuOc tinh, kieu tra ve Cmg yen kieu de lieu cila thuOc tinh.
b. ThuOc tinh:
—Std::string m_question: nOi dung cau hoi trac nghiem trong tep tin de lieu
—Std::string m_ansA: noi dung dap an A trong tep tin da lieu
—Std::string m_ansB: nOi dung dap an B trong tep tin de lieu
—Std::string m_ansC: nOi dung dap an C trong tep tin du lieu
—Std::string m_ansD: nOi dung dap an D trong tep tin de lieu
—Std::string m_topic: nOi dung de bai trong tep tin de lieu
—Std::string m_soundURL: dtremg dk tucmg doi cfla tep tin am thanh ductc km tep
tin de lieu
—Std::string m_ImgURL: throng clan tucmg dOi cua tep tin hinh anh ductc luu tep tin
de lieu Int m_ans: dap an dung dm du hoi troc nghiem. De lien so sanh n'en dap
an ducc luu dual clang sit "0, 1, 2, 3" tuong img yeti dap an "A, B, C, D"
—Int m_choice: (king de lint dap an da chip. Mic dinh bang "-1" tucmg Ung veri chua
chon.
—Int m_quesID: luu questionID tucmg 1mg trong tep tin de lieu
—Int m topicID: luu topiclD tucmg (mg trong tep tin de lieu
—Int m totalQues: luu tong so cau hoi c6 ding de bai tucmg img trong tep tin de lieu
—Int m_topicType: luu chit de tucmg Ung trong tep tin da lieu
69
4.2.5. FullTest
a. Phuang Mire:
—boo[ initDataO;
nghia: kited to giao dien
—static FullTest* create();
nghia: to dai tugng FullTest
—virtual void onBtnNextClicked(CCObject *obj);
"Cr nghia: xir ly logic viec chuyen den cau tiep theo(neu c6)
—virtual void onBtnBackClicked(CCObject *obj);
nghia: xir ly logic viec chuyen den cau truck da (neu co)
—void onShowMenu(CCObject *obj);
)1( nghia: Hien thi danh sach the eau hoi trong de thi. Danh sach nay co china dap an
da chgn tucmg Ung vgi eau tra Ibi
—void onAnswerClicked(int id);
1' nghia : xir ly logic sau khi nguai dung chgn dap an
—void onQuestionClicked(CCObject *obj);
Y nghia: chuyen den eau hoi ma ngu&i climg chgn tin danh sach cau hei
—void onBtnSubmitClicked(CCObject *obj);
nghia: xir IS, logic sau khi ngueri dung chgn hoan tat bli thi
—void sendRateToServerO;
ket qua coo ngued dimg len Server (neu c6 mang).
—void onHttpResponse( CCHttpClient *sender, CCHttpResponse *response );
—void update(float dt);
nghia: cop nhat th6i gian lam bai
—void generateToeicTest();
nghia: Kh6i to toan b0 bai thi
—int getRate();
nghia: Tinh diem
70
b. Thuac tinh:
—std::vector m_vListQuestion1D[7]: chfra danh sach chi so vi tri cac eau hoi
thuac tong c
Các file đính kèm theo tài liệu này:
- khoa_luan_nghien_cuu_engine_da_nen_tang_cocos2d_x_va_phat_tr.pdf