$$资本收益率=\frac{资本产生的收入-费用}{所用资本} * 100\%$$

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
LuckyBagWidget = {
R_Day_Text = nil;
R_ItemIcon_Image = nil;
R_Lock = nil;
R_Had = nil;
R_Ready = nil;
R_Ready_Button = nil;
R_Number_Text = nil;
R_Offseter = nil;
R_Info_Button = nil;
index = nil;
}

function LuckyBagWidget:new(widget)
local myself = {}
setmetatable(myself, self);
self.__index = self;
myself.R_Day_Text = widget:GetUIWidget(CS.EComponent.Text, 'R_Day_Text');
myself.R_ItemIcon_Image = widget:GetUIWidget(CS.EComponent.Image, 'R_ItemIcon_Image');
myself.R_Lock = widget:GetUIWidget('R_Lock');
myself.R_Had = widget:GetUIWidget('R_Had');
myself.R_Ready = widget:GetUIWidget('R_Ready');
myself.R_Info_Button = widget:GetUIWidget(CS.EComponent.Button, 'R_Info_Button');
myself.R_Info_Button.onClick:AddListener(OnClickInfo);
myself.R_Ready_Button = widget:GetUIWidget(CS.EComponent.Button, 'R_Ready_Button');
myself.R_Number_Text = widget:GetUIWidget(CS.EComponent.Text, 'R_Number_Text');
myself.R_Offseter = widget:GetUIWidget(CS.EComponent.RectTransform,'R_Offseter');
myself.R_Lock:SetActive(false);
myself.R_Had:SetActive(false);
myself.R_Ready:SetActive(false);
myself.R_Ready_Button.onClick:AddListener(
function ()
myself:OnClickGet();
end
);
return myself;

end

function LuckyBagWidget:SetValue(index)
self.index = index;
self.R_Day_Text.text = tostring(index + 1);
self.R_Number_Text.text = string.format('No.000%d', index + 1);
self.R_Offseter.anchoredPosition3D = CS.UnityEngine.Vector3(-index * 15, 0, 0);
local sprite = CS.PaintingLuckyBagModel.GetIcon(self.index + 1);
self.R_ItemIcon_Image:SetImageSprite(sprite);
end

function LuckyBagWidget:RefreshStatus()
self.R_Lock:SetActive(false);
self.R_Had:SetActive(false);
self.R_Ready:SetActive(false);
local status = CS.PaintingLuckyBagModel.GetLuckyBagStatus(self.index);
if status == 0 then -- not open
self.R_Lock:SetActive(true);
elseif status == 1 then -- open
self.R_Ready:SetActive(true);
elseif status == 2 then -- get
self.R_Had:SetActive(true);
end
end

function LuckyBagWidget:OnClickInfo()

end

function LuckyBagWidget:OnClickGet()
CS.PaintingLuckyBagModel.ToGetLuckyBag(self.index);
end

-- function LuckyBagWidget:OnEvent(event_id, event_param)
-- if event_id == CS.EventID.EID_RefreshLuckyBagStatus then
-- self:RefreshStatus();
-- end
-- end

return LuckyBagWidget;
1
2
3
4
from app.service import websocket

if __name__ == "__main__":
websocket.start()
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
pub fn execute() {
iter();
find();
}

fn iter() {
let vec1 = vec![1, 2, 3];
let vec2 = vec![4, 5, 6];

println!("2 in vec1: {}", vec1.iter().any(|&x| x == 2));
println!("2 in vec2:{}", vec2.into_iter().any(|x| x == 2));

let array1 = [1, 2, 3];
let array2 = [4, 5, 6];

println!("2 in array1: {}", array1.iter().any(|&x| x == 2));
println!("2 in array2: {}", array2.iter().any(|&x| x == 2));
}

fn find() {
let vec1 = vec![1, 2, 3];
let vec2 = vec![4, 5, 6];
let mut iter = vec1.iter();
let mut into_iter = vec2.into_iter();

println!("Find 2 in vec1: {:?}", iter.find(|&&x| x == 2));
println!("Find 2 in vec2: {:?}", into_iter.find(|&x| x == 2));

let array1 = [1, 2, 3];
let array2 = [4, 5, 6];
println!("Find 2 in array1: {:?}", array1.iter().find(|&&x| x == 2));
println!("Find 2 in array2: {:?}", array2.into_iter().find(|&&x| x == 2));
}