历史记录详情显示

This commit is contained in:
TJH 2026-04-29 16:55:41 +08:00
parent 4e7fcae46c
commit 7dee3af062
3 changed files with 1523 additions and 1347 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
import { _decorator, Button, Color, Component, EventHandler, instantiate, JsonAsset, Label, Layout, Node, ScrollView, sp, Sprite, SpriteAtlas, SpriteFrame, tween, UITransform, v3, Vec3 } from 'cc';
import { ScrollControl } from './ScrollControl';
import { fixNum, getTimezoneOffsetString, getTranslate, hideAllChildren, updateLang, waitNextFrame } from './Tools';
import { fixNum, getTimezoneOffsetString, getTranslate, hideAllChildren, ICON_RATE, updateLang, waitNextFrame } from './Tools';
let { ccclass, property } = _decorator;
@ccclass('HistoryDetail')
@ -346,7 +346,7 @@ export class HistoryDetail extends Component {
// 加载一盘数据
loadOne(item: Node, pan, idx, formattedData) {
let winInfo = pan.WinInfo;
let winInfo = pan.SymbolWinInfos;
item.position = new Vec3()
this.list_detail.content.addChild(item)
@ -399,18 +399,15 @@ export class HistoryDetail extends Component {
roller_wins.removeAllChildren();
let upIconIndexs = [];
if (winInfo != null) {
if (winInfo.Desc != null) {
let desc = winInfo.Desc;
// 对{}进行遍历
roller_gray.active = true;
for (let key in desc) {
let middle = desc[key];
upIconIndexs.push(...middle.Middle);
}
// 去重
upIconIndexs = upIconIndexs.filter((value, index, self) => self.indexOf(value) === index);
if (winInfo[0] != null) {
// 对{}进行遍历
roller_gray.active = true;
for (let key in winInfo) {
let middle = winInfo[key];
upIconIndexs.push(...middle.BottomPos);
}
// 去重
upIconIndexs = upIconIndexs.filter((value, index, self) => self.indexOf(value) === index);
}
for (let index = 0; index < pan.PanColor.Bottom.length; index++) {
@ -479,7 +476,7 @@ export class HistoryDetail extends Component {
// No Winning Combination
let node_no_winning = content.getChildByName("node_no_winning")
node_no_winning.active = pan.WinInfo == null;
node_no_winning.active = winInfo[0] == null;
//
let node_feature_buy = content.getChildByName("node_feature_buy")
@ -494,20 +491,20 @@ export class HistoryDetail extends Component {
node_win_multiplier_1.active = false;
if (winInfo != null) {
if (winInfo.MulDesc != null) {
let mulDesc = winInfo.MulDesc;
if (pan.RoundInfo.Mul > 1) {
// let mulDesc = winInfo.MulDesc;
let txt_win_multiplier = node_win_multiplier.getChildByName("txt_win_multiplier")
txt_win_multiplier.getComponent(Label).string = getTranslate(this.dict, "Win Multiplier") + " x " + mulDesc.Mul;
txt_win_multiplier.getComponent(Label).string = getTranslate(this.dict, "Win Multiplier") + " x " + pan.RoundInfo.Mul;
node_win_multiplier.active = true;
let txt_win_multiplier_1 = node_win_multiplier_1.getChildByName("txt_win_multiplier_1");
txt_win_multiplier_1.getComponent(Label).string = getTranslate(this.dict, "Win Multiplier");
let mulited = node_win_multiplier_1.getChildByName("mulited");
mulited.getComponent(Label).string = `${currencySymbol} ${fixNum(mulDesc.Multied)}` + '';
mulited.getComponent(Label).string = `${currencySymbol} ${fixNum(pan.RoundInfo.Score)}` + '';
let unmulited = node_win_multiplier_1.getChildByName("unmulited");
unmulited.getComponent(Label).string = `${currencySymbol} ${fixNum(mulDesc.UnMultied)} x ${mulDesc.Mul}`;
unmulited.getComponent(Label).string = `${currencySymbol} ${fixNum(pan.RoundInfo.AllScoreMul)} x ${pan.RoundInfo.Mul}`;
node_win_multiplier_1.active = true;
}
@ -543,68 +540,85 @@ export class HistoryDetail extends Component {
// let item_kind = instantiate(this.item_win_kind);
if (winInfo != null) {
if (winInfo.Desc != null) {
let node_formula = content.getChildByName('node_formula');
if (winInfo[0] != null) {
let node_formula = content.getChildByName('node_formula');
let desc = winInfo.Desc;
for (let key in desc) {
let symbolWinInfo = desc[key];
let item_win_kind = instantiate(this.item_win_kind)
item_win_kind.name = `item_win_kind_${key}`;
for (let key in winInfo) {
let symbolWinInfo = winInfo[key];
let hitColor = this.ICON_SERVER_MAP[pan.PanColor.Bottom[symbolWinInfo.BottomPos[0]]]
let item_win_kind = instantiate(this.item_win_kind)
item_win_kind.name = `item_win_kind_${hitColor}`;
let sp = item_win_kind.getChildByName("sp").getComponent(Sprite);
let path_symbol = `${this.ICON_SERVER_MAP[key]}`;
sp.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_symbol);
let bg = item_win_kind.getChildByName("bg").getComponent(Sprite);
let sp = item_win_kind.getChildByPath("bg/sp").getComponent(Sprite);
let path_symbol = `${hitColor}`;
bg.spriteFrame = this.bgAtlas.getSpriteFrame(path_symbol);
sp.spriteFrame = this.symbolsAtlas.getSpriteFrame(path_symbol);
let txt_kind = item_win_kind.getChildByName("txt_kind").getComponent(Label);
txt_kind.string = 'x' + symbolWinInfo.Middle.length;
let txt_kind = item_win_kind.getChildByName("txt_kind").getComponent(Label);
txt_kind.string = 'x' + symbolWinInfo.BottomPos.length;
let txt_win = item_win_kind.getChildByName("txt_win").getComponent(Label)
txt_win.string = `${currencySymbol}${fixNum(symbolWinInfo.Score)}`
let txt_win = item_win_kind.getChildByName("txt_win").getComponent(Label)
txt_win.string = `${currencySymbol}${fixNum(symbolWinInfo.Score)}`
let formula_detail = item_win_kind.getChildByName("formula_detail");
let formula_detail = item_win_kind.getChildByName("formula_detail");
let Label_Formual = formula_detail.getChildByName("Label_Formual").getComponent(Label)
Label_Formual.string = getTranslate(this.dict, "BxS")
let Label_Formual = formula_detail.getChildByName("Label_Formual").getComponent(Label)
Label_Formual.string = getTranslate(this.dict, "BxS")
let txt_formual_detail = formula_detail.getChildByName("txt_formual_detail").getComponent(Label)
txt_formual_detail.string = symbolWinInfo.Formula || 'No Data !!';
formula_detail.active = false;
let txt_formual_detail = formula_detail.getChildByName("txt_formual_detail").getComponent(Label)
txt_formual_detail.string = fixNum(pan.Bet) + ' x ' + this.getWinSymbolMulti(pan.PanColor.Bottom, symbolWinInfo.BottomPos).toFixed(2);
formula_detail.active = false;
item_win_kind.position = new Vec3()
item_win_kind.position = new Vec3()
item_win_kind.active = true;
node_formula.addChild(item_win_kind);
item_win_kind.active = true;
node_formula.addChild(item_win_kind);
}
// 每一条 item_win_kind 可以点开 自己的 formula_detail
// 要求列表前面的item_win_kind弹出来formula_detail ,盖住后面的 item_win_kind
// 但 addChild的顺序决定后 后面会盖住前面,所以这里要反转一下
// 而且一定要关掉 Layout ,因为它会把 SiblingIndex最小的放到最上面
let lyt = node_formula.getComponent(Layout)
lyt.updateLayout()
lyt.enabled = false
let children = node_formula.children.slice().reverse();
children.forEach((child, i) => {
child.active = true
child.setSiblingIndex(i);
});
let contentlyt = content.getComponent(Layout)
contentlyt.updateLayout()
contentlyt.enabled = false
// 多给一截滑动空间
content.getComponent(UITransform).height = content.getComponent(UITransform).height + 200
}
// 每一条 item_win_kind 可以点开 自己的 formula_detail
// 要求列表前面的item_win_kind弹出来formula_detail ,盖住后面的 item_win_kind
// 但 addChild的顺序决定后 后面会盖住前面,所以这里要反转一下
// 而且一定要关掉 Layout ,因为它会把 SiblingIndex最小的放到最上面
let lyt = node_formula.getComponent(Layout)
lyt.updateLayout()
lyt.enabled = false
let children = node_formula.children.slice().reverse();
children.forEach((child, i) => {
child.active = true
child.setSiblingIndex(i);
});
let contentlyt = content.getComponent(Layout)
contentlyt.updateLayout()
contentlyt.enabled = false
// 多给一截滑动空间
content.getComponent(UITransform).height = content.getComponent(UITransform).height + 200
}
hideAllChildren(item)
}
getWinSymbolMulti(panColor, BottomPos: any[]) {
let hitColor: number = this.ICON_SERVER_MAP[panColor[BottomPos[0]]]
let winLevel: number = 0
if (BottomPos.length <= 9) {
winLevel = 0
} else if (BottomPos.length <= 11) {
winLevel = 1
} else {
winLevel = 3
}
return ICON_RATE[hitColor][winLevel]
}
async loadDetailList() {
// 时间

View File

@ -36,6 +36,19 @@ interface LangTxt {
richTexts: RichText[]; // RichText 组件数组
}
export let ICON_RATE: number[][] = [
[0, 0, 0], // scatter
[10, 25, 50], // 神灯
[2.5, 10, 25], // 魔毯
[2, 5, 15], // 刀
[1.5, 2, 12], // 戒指
[1, 1.5, 10], // 项链
[0.8, 1.2, 8], // 瓶子
[0.5, 1, 5], // 金币
[0.4, 0.9, 4], // 银币
[0.2, 0.75, 2], // 铜币
]
export function fixNum(num: number): string {
return (num / 10000).toFixed(2)
}
@ -118,7 +131,7 @@ export function getTimezoneOffsetString(): string {
return `(GMT${sign}${hours}:${minutes})`;
}
export function updateLang(node: Node, dict, lang:string) {
export function updateLang(node: Node, dict, lang: string) {
let langText: LangTxt = { labels: [], richTexts: [] }
getLabelsAndRichTexts(node, langText)
@ -148,7 +161,7 @@ export function updateLang(node: Node, dict, lang:string) {
const staticTxt = richText.node.getComponent(StaticTxt)
richText.maxWidth = staticTxt.maxWidth
richText.string = wrapRichTextBySpace(richText, staticTxt.key, dict,lang)
richText.string = wrapRichTextBySpace(richText, staticTxt.key, dict, lang)
})
return langText
@ -219,7 +232,7 @@ export function wrapRichTextBySpace(richText: RichText, key: string, dict, lang)
}
}
}
}else{
} else {
// 非婆罗米系文字,引擎自动换行就能处理好
// 不需要手动计算
wrapResult.result += part.value