-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinterface.js
152 lines (142 loc) · 6.78 KB
/
interface.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
var sgs = sgs || {};
(function (sgs) {
sgs.interface = {};
sgs.interface.bout = {};
sgs.interface.HERO_PROPERTY_MAPPING = {};
$.each(sgs.HERO, (function(hero_mapping) {
return function(i, d) {
hero_mapping[d.name] = { "skill": d.skills };
}
})(sgs.interface.HERO_PROPERTY_MAPPING));
sgs.interface.cardInfo = {
/*
* 牌信息
*
* width - 牌宽度
* height - 牌高度
* out - 选中时突出的高度
*/
width: 95,
height: 133,
out: 20
};
/* 设置信息 */
sgs.interface.Set_RoleInfo = function(player, dom) {
if(dom != undefined)
player.dom = dom;
if(!player.isAI) {
$('#player_country').attr('src', sgs.COUNTRY_IMG_MAPPING[player.hero.country]);
$('#player_name').text(player.nickname);
$('#player_head_img').attr('src', 'img/generals/big/' + sgs.HEROIMAG_MAPPING[player.hero.name]);
for (var i = 0; i < player.hero.life; i++) {
$('<img src="img/system/blod_0.png" />').appendTo($('#player_blod_0'));
$('<img src="img/system/blod_1.png" />').appendTo($('#player_blod_1'));
}
$("#player_identity img").attr('src', sgs.IDENTITY_IMG_MAPPING[player.identity]);
$('#player_head')[0].name = player.hero.name;
} else {
$(player.dom).find('.role_country img').attr('src', sgs.COUNTRY_IMG_MAPPING[player.hero.country]);
$(player.dom).find('.role_name').text('_' + player.hero.name + '_');
if(player.identity == 0)
$(player.dom).find('.role_identity img').attr('src', sgs.IDENTITY_IMG_MAPPING[0]);
$(player.dom).find('.head_img img').attr('src', 'img/generals/small/' + sgs.HEROIMAG_MAPPING[player.hero.name]);
for(var k = 0; k < player.hero.life; k++) {
$(player.dom).find('.blods_0').append('<img src="img/system/blod_0.png" />');
$(player.dom).find('.blods_1').append('<img src="img/system/blod_1.png" />');
}
$(player.dom).find('.head_img')[0].name = player.hero.name;
}
};
/* 数据加载 */
sgs.interface.Load_Data = function() {
$('#data_load').css('display', 'block');
$.each(sgs.IMG_LIST, function(i, d) {
$('#load_imgs').append($('<img src=' + d + ' />'));
});
var count = 0;
$('#load_imgs img').load(function() {
count++;
if(/data_load_bg.jpg/.test($(this).attr('src')))
$('#main').css('display', 'block');
$('#data_load_perc').text(parseInt(count / sgs.IMG_LIST.length * 100) + '%');
if(count == sgs.IMG_LIST.length) {
$('#data_load').animate({
opacity: 0
}, 1000, function() {
$('#data_load').css('display', 'none');
});
}
});
}
/* 显示选牌框(选将/五谷/观星/..) */
sgs.interface.Show_CardChooseBox = function(title, cards, identity_info) {
var card_count = cards.length,
title_width = title.length * 18 + 20,
title_height = 24,
card_padding = 3,
box_width = card_count * 93 + (card_count - 1) * card_padding * 2 + 40,
box_height = identity_info == undefined ? 180 : 210,
card_choose_bg = $('<div id="choose_box_bgcover"></div>'),
card_choose_box = $([
'<div id="choose_box">',
'<div>',
'<div id="choose_box_content">',
'<div id="choose_box_bgimgs">',
'<img id="choose_box_bg" src="img/system/card_choose_bg.png" />',
'<div id="choose_box_title">',
'<img src="img/system/card_choose_title.png" />',
'<font></font>',
'</div>',
'</div>',
'<div id="choose_cards"></div>',
'</div>',
'</div>',
'</div>'
].join(''));
card_choose_box.find('#choose_box_title').css({
width: title_width + 'px',
height: title_height + 'px',
left: (box_width - title_width) / 2 + 'px',
});
card_choose_box.find('#choose_box_title font').css('line-height', title_height + 'px');
card_choose_box.find('#choose_box_content').css({
width: box_width + 'px',
height: box_height + 'px',
});
card_choose_box.find('#choose_box_title font').text(title);
if(identity_info != undefined) {
$.each(cards, function(i, d) {
var card = $('<div class="choose_role_card"><img src="img/generals/hero/' +
sgs.HEROIMAG_MAPPING[d.name] + '" /></div>');
card[0].name = d.name;
card.css('left', i * (93 + card_padding * 2) + 'px');
card_choose_box.find('#choose_cards').append(card);
});
card_choose_box.find('#choose_box_content').append([
'<div class="player_progress_bar" style="display:block; bottom:25px; left:20px;">',
'<img class="player_progress_bg" src="img/system/progress/big/progress_bg.png" />',
'<img class="player_progress" src="img/system/progress/big/progress.png" />',
'<img class="player_progress_bg" src="img/system/progress/big/progress_border.png" />',
'</div>'
].join('')).append('<div id="identity">' + identity_info + '</div>');
card_choose_box.find('.player_progress_bar').css({
height: '15px',
left: (box_width - 300) / 2 + 'px',
bottom: '30px',
});
} else {
$.each(cards, function(i, d) {
var card = $(['<div class="choose_card"><img src="',
sgs.CARDIMAG_MAPING[d.name], '" /><div class="pat_num" style="color:',
d.color, ';"><span class="pattern"><img src="',
sgs.PATTERN_IMG_MAPPING[d.color], '" /></span><span class="num">',
sgs.CARD_COLOR_NUM_MAPPING.number[d.digit], '</span></div><div class="select_unable"></div></div>'].join(''));
card[0].name = d.name;
card.css('left', i * (93 + card_padding * 2) + 'px');
card_choose_box.find('#choose_cards').append(card);
});
}
card_choose_bg.appendTo($('#main'));
card_choose_box.appendTo($('#main'));
};
})(window.sgs);