SHOW:
|
|
- or go back to the newest paste.
1 | function updatePuffleWidget() | |
2 | { | |
3 | trace("INTERFACE:updatePuffleWidget"); | |
4 | var active_puffle_id = getActivePuffle(); | |
5 | var swf_art_mc = PUFFLE_WIDGET.art_mc; | |
6 | var active_puffle = SHELL.getMyPuffleById(active_puffle_id); | |
7 | var hunger_swf_frame_step = Math.round(active_puffle.hunger / 10); | |
8 | var health_swf_frame_step = Math.round(active_puffle.health / 10); | |
9 | var rest_swf_frame_step = Math.round(active_puffle.rest / 10); | |
10 | var happy_value = active_puffle.happy; | |
11 | trace("puffle happy: " + active_puffle.happy + " puffle name: " + active_puffle.name); | |
12 | if(happy_value > 75) | |
13 | { | |
14 | var happy_swf_frame_step = 1; | |
15 | } | |
16 | else if(happy_value > 50) | |
17 | { | |
18 | happy_swf_frame_step = 2; | |
19 | } | |
20 | else if(happy_value > 25) | |
21 | { | |
22 | happy_swf_frame_step = 3; | |
23 | } | |
24 | else | |
25 | { | |
26 | happy_swf_frame_step = 4; | |
27 | } | |
28 | swf_art_mc.paper_mc.gotoAndStop(active_puffle.typeID + 1); | |
29 | swf_art_mc.paper_mc.art_mc.gotoAndStop(happy_swf_frame_step); | |
30 | swf_art_mc.name_txt.text = active_puffle.name; | |
31 | swf_art_mc.stats_mc.gotoAndStop(shell.getLocalizedFrame()); | |
32 | swf_art_mc.stats_mc.hunger_mc.gotoAndStop(hunger_swf_frame_step); | |
33 | swf_art_mc.stats_mc.health_mc.gotoAndStop(health_swf_frame_step); | |
34 | swf_art_mc.stats_mc.rest_mc.gotoAndStop(rest_swf_frame_step); | |
35 | swf_art_mc.tab_btn.onRelease = openPuffleWidgetTab; | |
36 | swf_art_mc.play_btn.onRelease = function() | |
37 | { | |
38 | sendPufflePlay(); | |
39 | closeHint(); | |
40 | }; | |
41 | swf_art_mc.play_btn.onRollOver = function() | |
42 | { | |
43 | showHint(this,"play_puffle_hint"); | |
44 | }; | |
45 | swf_art_mc.play_btn.onRollOut = closeHint; | |
46 | swf_art_mc.rest_btn.onRelease = function() | |
47 | { | |
48 | sendPuffleRest(); | |
49 | closeHint(); | |
50 | }; | |
51 | swf_art_mc.rest_btn.onRollOver = function() | |
52 | { | |
53 | showHint(this,"rest_puffle_hint"); | |
54 | }; | |
55 | swf_art_mc.rest_btn.onRollOut = closeHint; | |
56 | swf_art_mc.feed_btn.onRelease = function() | |
57 | { | |
58 | openPuffleWidgetTab(); | |
59 | closeHint(); | |
60 | }; | |
61 | swf_art_mc.feed_btn.onRollOver = function() | |
62 | { | |
63 | showHint(this,"feed_puffle_hint"); | |
64 | }; | |
65 | swf_art_mc.feed_btn.onRollOut = closeHint; | |
66 | swf_art_mc.walk_btn.onRelease = function() | |
67 | { | |
68 | sendPuffleWalk(); | |
69 | closeHint(); | |
70 | }; | |
71 | swf_art_mc.walk_btn.onRollOver = function() | |
72 | { | |
73 | showHint(this,"walk_puffle_hint"); | |
74 | }; | |
75 | swf_art_mc.walk_btn.onRollOut = closeHint; | |
76 | swf_art_mc.close_btn.onRelease = closePuffleWidget; | |
77 | } |