dzduole 1 napja
szülő
commit
d0a5168998

+ 1 - 5
art/fgui/.objs/workspace.json

@@ -1,5 +1,5 @@
 {
-  "libview.firstColumnWidth": 270,
+  "libview.firstColumnWidth": 283,
   "expanded_nodes": [
     "isxx5ak7",
     "/",
@@ -16,10 +16,6 @@
     "isxx5ak7",
     "/",
     "isxx5ak7",
-    "/UIMain/",
-    "isxx5ak7",
-    "/UIMain/component/",
-    "isxx5ak7",
     "/UISecretary/",
     "isxx5ak7",
     "/UISecretary/UIFuli/",

BIN
art/fgui/assets/game/UIDraw/asset/bj22.jpg


+ 8 - 0
art/fgui/assets/game/UIDraw/component/Component1304.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<component size="1700,750">
+  <displayList>
+    <image id="n1_wcn5" name="n1" src="bf9jv4ju" fileName="UISign/asset/qd_bg.jpg" xy="0,0">
+      <relation target="" sidePair="center-center,middle-middle"/>
+    </image>
+  </displayList>
+</component>

BIN
art/fgui/assets/game/UISign/asset/qd_bg.png


BIN
art/fgui/assets/game/n1.png


+ 6 - 0
art/fgui/assets/game/package.xml

@@ -1343,6 +1343,12 @@
     <component id="loypv59q" name="Component_fuli1.xml" path="/UIMain/component/"/>
     <component id="loypv59r" name="Button_h.xml" path="/UISecretary/UIFuli/component/"/>
     <component id="loypv59s" name="Button_lv.xml" path="/UISecretary/UIFuli/component/"/>
+    <image id="udljv59t" name="n1.png" path="/"/>
+    <image id="udljv59u" name="bj.jpg" path="/UIDraw/asset/"/>
+    <image id="udljv59v" name="bj22.jpg" path="/UIDraw/asset/"/>
+    <image id="udljv59w" name="qd_bg.jpg" path="/UIDraw/asset/"/>
+    <component id="udljv59x" name="Component1304.xml" path="/UIDraw/component/"/>
+    <image id="udljv59y" name="qd_bg.png" path="/UISign/asset/"/>
   </resources>
   <publish name="game" path="..\..\client\laya\bin\asset\fgui" packageCount="2" genCode="true" codePath="..\..\client\laya\src\fgui\res"/>
 </packageDescription>

BIN
client/laya/bin/asset/fgui/game.obj


+ 139 - 32
client/laya/bin/js/bundle.js

@@ -879,7 +879,7 @@
             return reqData;
         }
         sendPost2025(reqUrl, data, call) {
-            let isDev = false;
+            let isDev = true;
             let urlTop = "https://api.kessongame.site/";
             let urlMid = urlTop + "prod-api/api/";
             if (isDev) {
@@ -5847,34 +5847,6 @@
         }
     }
 
-    class DaoJuDisplay {
-        constructor(ui, index) {
-            this.index = 0;
-            this.uiIndex = 0;
-            this.ui = ui;
-            this.index = index;
-            this.initData();
-        }
-        initData() {
-            this.ui.btn_buy.onClick(this, this.buySp);
-            this.ui.btn_buy.onClick(this, this.buyDj);
-            let data = cfgTable.daoJuData[this.index + 1];
-            console.log('zh:' + JSON.stringify(data));
-            this.ui.nameTxt.text = data.spbt;
-            this.ui.n_jiaGe.text = data.spjg + "";
-            this.ui.n_zuanShi.text = "X" + data.zssl + "";
-            let baseUrl = "asset/sound/ogg/";
-            this.ui.zsImg.url = xGame.common.getGameIconUrl(data.img);
-        }
-        buyDj() {
-            xGame.soundMgr.playSound(xGame.common.btnClickStr);
-        }
-        buySp() {
-            let data = cfgTable.daoJuData[this.index + 1];
-            console.log('zh:点击购买 data =' + JSON.stringify(data));
-        }
-    }
-
     class ui_UIMsg extends fgui.GComponent {
         static createInstance() {
             return (fgui.UIPackage.createObject("game", "UIMsg"));
@@ -5907,6 +5879,62 @@
     }
     UIMsg.uiName = "UIMsg";
 
+    class DaoJuDisplay {
+        constructor(ui, index) {
+            this.index = 0;
+            this.uiIndex = 0;
+            this.ui = ui;
+            this.index = index;
+            this.initData();
+        }
+        initData() {
+            this.ui.btn_buy.onClick(this, this.buySp);
+            this.ui.btn_buy.onClick(this, this.buyDj);
+            let data = cfgTable.daoJuData[this.index + 1];
+            console.log('zh:' + JSON.stringify(data));
+            this.ui.nameTxt.text = data.spbt;
+            this.ui.n_jiaGe.text = data.spjg + "";
+            this.ui.n_zuanShi.text = "X" + data.zssl + "";
+            let baseUrl = "asset/sound/ogg/";
+            this.ui.zsImg.url = xGame.common.getGameIconUrl(data.img);
+        }
+        buyDj() {
+            xGame.soundMgr.playSound(xGame.common.btnClickStr);
+        }
+        buySp() {
+            let djItem = cfgTable.daoJuData[this.index + 1];
+            console.log('zh:点击购买 djItem =' + JSON.stringify(djItem));
+            let userInfo = LocalStorageManager.getItem('userInfo');
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg, 'Please log in to your account .');
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.spItem = djItem;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyZuanShi', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
+        }
+    }
+
     class UIShop extends UIBase {
         constructor() {
             super();
@@ -6810,6 +6838,7 @@
                             };
                             LocalStorageManager.setItem(keyStr, jsonStr);
                             xGame.uiMgr.Show(UIMsg, msg);
+                            DataMgr.getUserZiChanInfo();
                             this.closeSelf();
                         }
                         else {
@@ -7298,6 +7327,7 @@
                 console.log("zh:播放小秘书每天语音");
             }
             this.onGetUserInfo();
+            DataMgr.getUserZiChanInfo();
             this.ui.n83.visible = false;
             if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
                 const d = LocalStorageManager.getItem(keyForLoginInfo);
@@ -18277,6 +18307,14 @@
             xGame.eventMgr.event(COIN_CHANGE);
             this.updateUserInfo2Server("jb");
         }
+        static setCoinFormServer(val) {
+            if (typeof val != "number") {
+                return;
+            }
+            this.userData.coin = val;
+            this.saveUserData();
+            xGame.eventMgr.event(COIN_CHANGE);
+        }
         static getCoin() {
             return this.userData.coin;
         }
@@ -18296,6 +18334,14 @@
             xGame.eventMgr.event(DIAMOND_CHANGE);
             this.updateUserInfo2Server("zs");
         }
+        static setDiamondFormServer(val) {
+            if (typeof val != "number") {
+                return;
+            }
+            this.userData.diamond = val;
+            this.saveUserData();
+            xGame.eventMgr.event(DIAMOND_CHANGE);
+        }
         static getDiamond() {
             return this.userData.diamond;
         }
@@ -18569,7 +18615,6 @@
             this.saveDiyGameData();
         }
         static updateUserInfo2Server(type, count = 0) {
-            const keyForLoginInfo = "userInfo";
             const userInfoData = Laya.LocalStorage.getItem(keyForLoginInfo);
             if (userInfoData == null) {
                 return;
@@ -18610,6 +18655,38 @@
                 }
             });
         }
+        static getUserZiChanInfo() {
+            console.log('zh:开始获取用户资产信息');
+            const userInfoData = Laya.LocalStorage.getItem(keyForLoginInfo);
+            if (userInfoData == null) {
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            xGame.httpMgr.sendPost2025('user/getUserGameInfo', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 200) {
+                        let d = res.data;
+                        let zuanShi = d.zuanShi;
+                        let jinBi = d.jinBi;
+                        let haveQiuGanJson = d.haveQiuGanJson;
+                        DataMgr.setDiamondFormServer(zuanShi);
+                        DataMgr.setCoinFormServer(jinBi);
+                    }
+                    else {
+                        alert(msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
+        }
     }
     DataMgr.isNewUser = false;
     DataMgr.fristEnter = true;
@@ -22678,8 +22755,36 @@
             xGame.soundMgr.playSound(xGame.common.btnClickStr);
         }
         buySp() {
-            let data = cfgTable.daoJuData[this.index + 1];
-            console.log('zh:点击购买 data =' + JSON.stringify(data));
+            let djItem = cfgTable.daoJuData[this.index + 1];
+            console.log('zh:点击购买 djItem =' + JSON.stringify(djItem));
+            let userInfo = LocalStorageManager.getItem('userInfo');
+            if (userInfo == null) {
+                xGame.uiMgr.Show(UIMsg$1, 'Please log in to your account .');
+                return;
+            }
+            let reqData = xGame.httpMgr.getReqData();
+            let pd = JSON.parse(reqData);
+            pd.spItem = djItem;
+            reqData = JSON.stringify(pd);
+            xGame.httpMgr.sendPost2025('user/buyZuanShi', reqData, (res) => {
+                try {
+                    console.log('zh:buySp res = ' + JSON.stringify(res));
+                    let code = res.code;
+                    let msg = res.msg;
+                    if (code == 200) {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                    }
+                    else {
+                        xGame.uiMgr.Show(UIMsg$1, msg);
+                    }
+                }
+                catch (error) {
+                    console.log('error=' + error);
+                    alert(error);
+                }
+                finally {
+                }
+            });
         }
     }
 
@@ -23216,6 +23321,7 @@
                             };
                             LocalStorageManager.setItem(keyStr, jsonStr);
                             xGame.uiMgr.Show(UIMsg$1, msg);
+                            DataMgr.getUserZiChanInfo();
                             this.closeSelf();
                         }
                         else {
@@ -23768,6 +23874,7 @@
                 console.log("zh:播放小秘书每天语音");
             }
             this.onGetUserInfo();
+            DataMgr.getUserZiChanInfo();
             this.ui.n83.visible = false;
             if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
                 const d = LocalStorageManager.getItem(keyForLoginInfo);

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
client/laya/bin/js/bundle.js.map


+ 1 - 1
client/laya/src/core/mgrs/HttpMgr.ts

@@ -63,7 +63,7 @@ export class HttpMgr {
      * post请求,参数待扩展
      */
     public sendPost2025(reqUrl, data, call) {
-        let isDev = false;//是否是开发环境
+        let isDev = true;//是否是开发环境
         // let urlStr ="https://api.kessongame.site/prod-api/api/game/";
         //////////////https://api.kessongame.site/prod-api/api/game/getClassicCfg
         let urlTop = "https://api.kessongame.site/";

+ 80 - 3
client/laya/src/data/DataMgr.ts

@@ -1,4 +1,4 @@
-import { CHANGE_SECRETARY, COIN_CHANGE, DIAMOND_CHANGE, POWER_CHANGE } from "../data/Define";
+import { CHANGE_SECRETARY, COIN_CHANGE, DIAMOND_CHANGE, POWER_CHANGE, keyForLoginInfo } from "../data/Define";
 import { xGame } from "../xGame";
 import { GameData, ItemData, UserData, Diy2025GameData } from "./Data"
 
@@ -300,6 +300,22 @@ export default class DataMgr {
         xGame.eventMgr.event(COIN_CHANGE);
         this.updateUserInfo2Server("jb");
     }
+
+    /**
+     * set jb  从服务器获取的金币信息
+     * @param val 
+     * @returns 
+     */
+    public static setCoinFormServer(val) {
+        if (typeof val != "number") {
+            return;
+        }
+        this.userData.coin = val;
+        this.saveUserData();
+        xGame.eventMgr.event(COIN_CHANGE);
+    }
+
+
     public static getCoin() {
         return this.userData.coin;
     }
@@ -321,6 +337,21 @@ export default class DataMgr {
         xGame.eventMgr.event(DIAMOND_CHANGE);
         this.updateUserInfo2Server("zs");
     }
+
+    /**
+     * 更新钻石数量
+     * @param val 
+     * @returns 
+     */
+    public static setDiamondFormServer(val) {
+        if (typeof val != "number") {
+            return;
+        }
+        this.userData.diamond = val;
+        this.saveUserData();
+        xGame.eventMgr.event(DIAMOND_CHANGE);
+    }
+
     //钻石
     public static getDiamond() {
         return this.userData.diamond;
@@ -639,8 +670,6 @@ export default class DataMgr {
      * @param count 数量
      */
     public static updateUserInfo2Server(type: string, count: number = 0) {
-
-        const keyForLoginInfo = "userInfo";
         const userInfoData = Laya.LocalStorage.getItem(keyForLoginInfo);
         if (userInfoData == null) {
             //alert('Please log in.');
@@ -683,4 +712,52 @@ export default class DataMgr {
         });
 
     }
+
+
+
+    /**
+     * 获取用户资产信息,此次应该会被经常调用,所以后期需要挪走到模块中
+     */
+    public static getUserZiChanInfo() {
+        console.log('zh:开始获取用户资产信息');
+        const userInfoData = Laya.LocalStorage.getItem(keyForLoginInfo);
+        if (userInfoData == null) {
+            //alert('Please log in.');
+            return;
+        }
+        let reqData = xGame.httpMgr.getReqData();
+        // let pd: any = JSON.parse(reqData);
+        // reqData = JSON.stringify(pd);
+        xGame.httpMgr.sendPost2025('user/getUserGameInfo', reqData, (res) => {
+            try {
+                console.log('zh:buySp res = ' + JSON.stringify(res))
+                let code = res.code;
+                let msg = res.msg;
+                if (code == 200) {
+                    let d = res.data;
+                    let zuanShi = d.zuanShi;
+                    let jinBi = d.jinBi;
+                    let haveQiuGanJson = d.haveQiuGanJson;
+                    DataMgr.setDiamondFormServer(zuanShi);
+                    DataMgr.setCoinFormServer(jinBi);
+                    // "noAdAll": 0,
+                    // "noAdChaping": 0,
+                    // "noAdJiangli": 0,
+                    // "gameChallengeLev": 0
+                    //xGame.uiMgr.Show(UIMsg, msg)
+                } else {
+                    alert(msg);
+                }
+                // if (Laya.Browser.onAndroid) {
+                //     JSBridgeUtils.instance.showToast2(msg);
+                // }
+            } catch (error) {
+                console.log('error=' + error);
+                alert(error);
+            } finally {
+
+            }
+        });
+    }
+
 }

+ 647 - 0
client/laya/src/fgui/res/game/UIMain.ts

@@ -0,0 +1,647 @@
+import SpineMgr from "../core/mgrs/SpineMgr";
+import DataMgr from "../data/DataMgr";
+import { CHANGE_SECRETARY, GameMode, GET_USER_INFO, RESTART_GAME, keyForLoginInfo } from "../data/Define";
+import UIBase from "../fgui/core/UIBase";
+import ui_UIMain from "../fgui/res/game/ui_UIMain";
+import PlatMgr from "../game/PlatMgr";
+import { xGame } from "../xGame";
+import MoneyNode from "./item/MoneyNode";
+import SettingNode from "./item/SettingNode";
+import UIAddProp from "./UIAddProp";
+import UIDraw from "./UIDraw";
+import { UIGame } from "./UIGame";
+import UIGameEnd from "./UIGameEnd";
+import UIInvitation from "./UIInvitation";
+import UILevelDisplay from "./UILevelDisplay";
+import UIMatching from "./UIMatching";
+import UIRanking from "./UIRanking";
+import UISecretary from "./UISecretary";
+import UIShop from "./UIShop";
+import UISign from "./UISign";
+import UISkill from "./UISkill";
+import UIMsg from "./UIMsg";
+import UIModeSelection from "./UIModeSelection";
+import GlobalManager from "../utils/GlobalManager";
+import JSBridgeUtils from "../utils/JSBridgeUtils";
+import SkillDisplay from "./item/SkillDisplay";
+import UIReg from "./UIReg";
+import UILogin from "./UILogin";
+import UIFuli1 from "./UIFuli1";
+import UIFuli2 from "./UIFuli2";
+import UITry from "./UITry";
+import UIPower from "./UIPower";
+import UIGetAward from "./UIGetAward";
+import UIRepentProp from "./UIRepentProp";
+import UIBox from "./UIBox";
+import UIAddCoin from "./UIAddCoin";
+import { NoInternetDialog } from "./NoInternetDialog";
+//import NetCheckTool from "../utils/NetCheckTool";
+import { LocalStorageManager } from "../utils/LocalStorageManager";
+
+
+
+export default class UIMain extends UIBase {
+    public ui: ui_UIMain;
+    public settingNode: SettingNode;
+    public moneyNode: MoneyNode;
+    public firstEnter = true;
+
+    nativeCallJs(msg: string) {
+        let t = msg;
+        console.log("zh: nativeCallJs 奖励开始发放:", t);
+        //GlobalManager.instance.callMethod(msg)
+
+        switch (t) {
+            case 'qjff_chouJiang':
+                let dui = <UIDraw>xGame.uiMgr.getUI(UIDraw);
+                dui.qjff_chouJiang();
+                break;
+            case 'qjff_AD_for_uisign':
+                let dui2 = <UISign>xGame.uiMgr.getUI(UISign);
+                dui2.qjff_AD_for_uisign();
+                break;
+            case 'qjff_AD_for_uitry':
+                let dui3 = <UITry>xGame.uiMgr.getUI(UITry);
+                dui3.qjff_AD_for_uitry();
+                break;
+            case 'qjff_AD_for_uipower':
+                let dui4 = <UIPower>xGame.uiMgr.getUI(UIPower);
+                dui4.qjff_AD_for_uipower();
+                break;
+            case 'qjff_AD_for_uigetAward':
+                let dui5 = <UIGetAward>xGame.uiMgr.getUI(UIGetAward);
+                dui5.qjff_AD_for_uigetAward();
+                break;
+            case 'qjff_AD_for_uiGameEnd':
+                let temp_level = Laya.LocalStorage.getItem('temp_qjff_AD_for_uiGameEnd_level');
+                let dui6 = <UIGameEnd>xGame.uiMgr.getUI(UIGameEnd);
+                dui6.qjff_AD_for_uiGameEnd(parseInt(temp_level))
+                break;
+            case 'qjff_AD_for_uiAddProp_videoGetDiamond':
+
+                let dui7 = <UIAddProp>xGame.uiMgr.getUI(UIAddProp);
+                dui7.qjff_AD_for_uiAddProp_videoGetDiamond();
+                break;
+
+            case 'qjff_AD_for_uiAddProp_videoGetCoin':
+                let dui8 = <UIAddProp>xGame.uiMgr.getUI(UIAddProp);
+                dui8.qjff_AD_for_uiAddProp_videoGetCoin();
+                break;
+            case 'qjff_AD_for_UIrepentProp_videoRegret':
+                let dui9 = <UIRepentProp>xGame.uiMgr.getUI(UIRepentProp);
+                dui9.qjff_AD_for_UIrepentProp_videoRegret();
+                break;
+
+            case 'qjff_AD_for_UIrepentProp_videoAddHelpLine':
+                let dui10 = <UIRepentProp>xGame.uiMgr.getUI(UIRepentProp);
+                dui10.qjff_AD_for_UIrepentProp_videoAddHelpLine();
+                break;
+
+            case 'qjff_AD_for_UIBOX_onOpenBox':
+                let dui11 = <UIBox>xGame.uiMgr.getUI(UIBox);
+                dui11.qjff_AD_for_UIBOX_onOpenBox();
+                break;
+
+            case 'qjff_AD_for_UIAddCoin':
+                let dui12 = <UIAddCoin>xGame.uiMgr.getUI(UIAddCoin);
+                dui12.qjff_AD_for_UIAddCoin();
+                break;
+            // case 'qjff_AD_for_skilldisplay_clickAddLevel':
+            //    // SkillDisplay s=new SkillDisplay();//改为插屏了
+            //   //  s.qjff_AD_for_skilldisplay_clickAddLevel();
+            //     break;
+            case '111a':
+                let dui14 = <UISign>xGame.uiMgr.getUI(UISign);
+                dui14.qjff_AD_for_uisign();
+                break;
+            case '222a':
+                let dui15 = <UISign>xGame.uiMgr.getUI(UISign);
+                dui15.qjff_AD_for_uisign();
+                break;
+            case '333a':
+                let dui16 = <UISign>xGame.uiMgr.getUI(UISign);
+                dui16.qjff_AD_for_uisign();
+                break;
+
+            default:
+                console.log('zh:未知的方法名字' + t)
+                break;
+
+        }
+
+
+        // if(t === 'qjff_shengJi_for_SkillDisplay'){
+        //     const dui = new 
+        //     dui.qjff_shengJi();
+        // }
+
+
+
+    }
+
+
+    public constructor() {
+        super();
+    }
+    protected onConstructor(): void {
+        console.log('zh: UIMain onConstructor');
+        this.ui = ui_UIMain.createInstance();
+        this.contentPane = this.ui;
+        this.isEject = false;
+        // this.ui.weeklyBtn.visible = false;
+        this.addEvent();
+        this.addClickSpine();
+        //设置界面
+        this.settingNode = new SettingNode(this.ui.settingNode);
+        this.moneyNode = new MoneyNode(this.ui.moneyNode);
+        //
+        xGame.eventMgr.on(RESTART_GAME, this, this.beginGame);
+        xGame.eventMgr.on(GET_USER_INFO, this, this.onGetUserInfo);
+        xGame.eventMgr.on(CHANGE_SECRETARY, this, this.changeSecretary);
+
+
+        let curUse = DataMgr.getCurSecretary();
+        this.changeSecretary(curUse);
+
+        //
+        //this.ui.rankBtn.visible = false;
+        this.ui.talkNode.visible = false;
+        let guide = DataMgr.getSkillGuide();
+        if (xGame.common.isNewDay && guide == 1) {
+            xGame.common.isNewDay = false;
+            xGame.soundMgr.playSound("s_main01");
+            xGame.common.showGirlTalkPop(1, this.ui.talkNode, this.ui.talkNode.womanTxt);
+            console.log("zh:播放小秘书每天语音");
+        }
+        this.onGetUserInfo();
+        this.ui.n83.visible = false;
+        //万宁台球
+        //Moyu.setShareInfo("8Ball Fury", ["台球", "台球", "桌球"], '2300002254');
+
+
+
+        if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
+            const d = LocalStorageManager.getItem<{ username: string, token: string }>(keyForLoginInfo);
+            let ua = d.username;
+            this.ui.headNode.nameTxt.text = xGame.tools.reviseString(ua, 16);
+        }
+       
+
+        window['nativeCallJs'] = this.nativeCallJs.bind(this);
+    }
+
+    Logout() {
+        if (LocalStorageManager.hasJosnKey(keyForLoginInfo)) {
+            //const d = LocalStorageManager.getItem<{ username: string, token: string }>(keyForLoginInfo);
+            LocalStorageManager.removeItem(keyForLoginInfo);
+            this.freshUser();
+        }
+    }
+    gotoLogin() {
+        xGame.uiMgr.Show(UILogin);
+    }
+    gotoRegUser() {
+        xGame.uiMgr.Show(UIReg);
+    }
+    showFuLi() {
+        console.log('zh:福利2');
+        xGame.uiMgr.Show(UIFuli1);
+        xGame.uiMgr.Show(UIFuli2);
+        console.log('zh:福利2222');
+    }
+
+   
+
+    changeSecretary(curUse) {
+        let name = cfgTable.secretaryshopData[curUse + 1].spine;
+        xGame.common.secretary && xGame.common.secretary.dispose();
+        this.addSecretarySpine(name);
+    }
+    addSecretarySpine(name) {
+        let spine = new SpineMgr(name, () => {
+            this.playSecretaryIdle();
+        });
+        xGame.common.secretary = spine;
+    }
+    addClickSpine() {
+        let clickSpine = new SpineMgr("dianji", () => {
+            Laya.stage.on(Laya.Event.CLICK, this, (e: Laya.Event) => {
+                //
+                let parent = Laya.stage;
+                let data = { x: e.stageX, y: e.stageY, scaleX: 0.8, scaleY: 0.8 };
+                clickSpine.play(data, 0, false, parent, (spine) => {
+                    spine.destroy(true);
+                });
+            })
+            //
+        });
+    }
+    private addEvent(): void {
+        this.addUIClick(this.ui.classicBtn, this.startGame, [GameMode.classic]);
+        this.addUIClick(this.ui.bigMoveBtn, this.startGame, [GameMode.bigMove])
+     
+        this.addUIClick(this.ui.globalBtn, this.startGlobal);
+        //  this.addUIClick(this.ui.weeklyBtn, this.startWeekly);
+        this.addUIClick(this.ui.placeBallBtn, this.startPlaceBall);
+        //
+        this.addUIClick(this.ui.headNode, this.onGetUserInfo, [true]);
+        this.addUIClick(this.ui, this.interuptSecretary);
+        this.addUIClick(this.ui.rightBtn, this.ensureSecretary);
+        this.addUIClick(this.ui.guideBtn, this.startGame, [GameMode.bigMove]);
+        this.addUIClick(this.ui.secretaryBtn, this.openSecretaryView);
+        this.addUIClick(this.ui.shopBtn, this.openShopView);
+
+        //
+        this.addUIClick(this.ui.signBtn, this.openSignView);
+        this.addUIClick(this.ui.drawBtn, this.openDrawView);
+        this.addUIClick(this.ui.rankBtn, this.openRanking);
+
+     
+
+
+    }
+    public show(showFailWords): void {
+        super.show();
+        //
+        this.moneyNode.ui.c1.selectedIndex = 1;
+        this.playSecretaryIdle();
+
+        xGame.soundMgr.playMusic("caromhall01", 0);
+
+
+        Laya.timer.clearAll(this);
+        this.playSecretaryRandomSound();
+        console.log('zh:uimain.ts   show  show FailWords=', showFailWords);
+        if (showFailWords) {
+            console.log('zh:uimain.ts   ')
+            //延迟播放进入主页面的失败音效
+            setTimeout(() => {
+                let str = Math.random() <= 0.5 ? "s_main02" : "s_main03";
+                let words = -1;
+                if (str == "s_main02") {
+                    words = 2;
+                }
+                else {
+                    words = 3;
+                }
+                xGame.common.showGirlTalkPop(words, this.ui.talkNode, this.ui.talkNode.womanTxt);
+                xGame.soundMgr.playSound(str);
+            }, 300);
+        }
+
+
+        // setTimeout(() => {
+        //     console.log('zh:播放7背景音乐 m ')
+        //     xGame.soundMgr.playSound('bjyy_m', 0);
+        // }, 2000);
+
+
+        //
+        this.showGuide();
+        this.ui.guideBtn.x = this.ui.liucheng2.myMask.x;
+        this.ui.guideBtn.y = this.ui.liucheng2.myMask.y;
+        //
+        let guide = DataMgr.getSkillGuide();
+        if (guide == 1) {
+            let randTime = xGame.common.randomNum(300, 800);
+            if (this.firstEnter) {
+                console.log("zh: firstEnter");
+                this.firstEnter = false;
+                randTime += 900;
+            } else {
+                console.log("zh: no firstEnter");
+            }
+            Laya.timer.once(randTime, this, () => {
+                xGame.common.autoPopUIView();
+            })
+        }
+    }
+    checkActive(show) {
+        //console.log("是否处于最外层",show);
+        //wx banner太大
+        // if (!Moyu.isWx)
+        //    PlatMgr.showBanner(show);
+    }
+    showGuide() {
+        let guide = DataMgr.getSkillGuide();
+        this.ui.guideBtn.visible = guide == 0;
+        this.ui.enterGuide.visible = false;
+        this.ui.secretaryGuide.visible = guide == 0;
+        if (guide == 0) {
+            console.log("zh:显示引导");
+            xGame.soundMgr.playSound("s_guide");
+            xGame.common.showGirlTalkPop(16, this.ui.talkNode, this.ui.talkNode.womanTxt);
+        } else {
+            console.log("zh:不需要显示引导");
+        }
+    }
+    ensureSecretary() {
+        console.log('zh: ensureSecretary   ensureSecretaryensureSecretaryensureSecretaryensureSecretaryensureSecretary')
+        this.ui.secretaryGuide.visible = false;
+        this.ui.enterGuide.visible = true;
+        this.ui.wordsNode.t0.play();
+        //todo
+        if (DataMgr.getNewUser()) Moyu.sendDataEvent("gameReady");
+    }
+    playSecretaryIdle() {
+        let parent = this.ui.secretary.displayObject;
+        parent.destroyChildren();
+        let xx = this.ui.secretary.width / 2;
+        let yy = this.ui.secretary.height;
+
+        //  xx = Laya.stage.width / 2;
+        //  yy = Laya.stage.height;
+        let scale = xGame.common.getSecretaryScale();
+        let data = { x: xx, y: yy, scaleX: scale, scaleY: scale };
+        //console.log("zh:playSecretaryIdle", data);
+        //xGame.common.secretary.play(data, 1, true, parent);  这是老的秘书
+
+        xGame.common.secretary.play(data, 0, true, parent);
+    }
+    startGame(type: GameMode) {
+        if (!this.isReadyForLoadNetSource()) {
+            return;
+        }
+        //  console.log('zh: 停止播放主頁面背景音乐');
+        // xGame.soundMgr.stopMusic();
+
+
+        //进入游戏页面
+        xGame.common.gameMode = type;
+        //
+        Moyu.sendDataEvent("PlayGame", { type: type });
+        console.log('zh:进入游戏gameMode =' + xGame.common.gameMode);
+        switch (xGame.common.gameMode) {
+            case GameMode.classic:
+                console.log('zh:进入经典模式111111111');
+                //zhdiy - challenge mode作为教学练习关,完成2关解锁classic,
+                if (DataMgr.DIY_challengeMode_overLev_jieSuo_mark) {
+                    let db_over_lev = DataMgr.getChallengeMode_overLev();
+                    console.log('zh:classic db_over_lev=', db_over_lev);
+                    if (db_over_lev < DataMgr.DIY_challengeMode_overLev_jieSuo_Classic) {
+                        console.log('zh:判断是否可以玩该模式classic =NO');
+                        let tipStr = 'You must complete ' + DataMgr.DIY_challengeMode_overLev_jieSuo_Classic + ' levels in Challenge Mode to unlock Classic Mode.';
+                        xGame.uiMgr.Show(UIMsg, tipStr);
+                        return;
+                    } else {
+                        console.log('zh:可以玩该模式classic  66666666666666');
+                        this.beginGame();
+                    }
+                } else {
+                    console.log('zh:不需要判断是否可以玩该classic');
+                    let challengeTimes = DataMgr.getChallengeTimes();
+                    if (challengeTimes == 0) {
+                        xGame.uiMgr.Show(UIInvitation);
+                    }
+                    else {
+                        this.beginGame();
+                    }
+                    break;
+                }
+            case GameMode.bigMove:
+                console.error('zh:bigMove check');
+                let guide = DataMgr.getSkillGuide();
+                //zhdiy - challenge mode作为教学练习关,完成2关解锁classic,
+                if (DataMgr.DIY_challengeMode_overLev_jieSuo_mark && guide == 1) {
+                    let db_over_lev = DataMgr.getChallengeMode_overLev();
+                    console.log('zh:bigMove db_over_lev=', db_over_lev);
+                    if (db_over_lev < DataMgr.DIY_challengeMode_overLev_jieSuo_rodMethod) {
+                        let tipStr = 'Complete ' + DataMgr.DIY_challengeMode_overLev_jieSuo_rodMethod + ' levels in Challenge Mode to unlock the Rod Method Mode';
+                        xGame.uiMgr.Show(UIMsg, tipStr);
+                        return;
+                    } else {
+                        console.log('zh:可以玩该模式 bigMove');
+                        this.beginGame();
+                        if (DataMgr.getNewUser()) Moyu.sendDataEvent("gameStart0");
+                    }
+
+                } else {
+                    this.beginGame();
+                    if (DataMgr.getNewUser()) Moyu.sendDataEvent("gameStart0");
+                }
+                break;
+            default:
+                console.error('zh:未知错误!!!!');
+                break;
+        }
+    }
+    beginGame(isNice = false) {
+
+        console.log('zh:beginGame ');
+        //TODO:ZH 插屏AD
+        //let time = xGame.common.randomNum(1000, 2000);
+        //Moyu.showInsertAd(time, 60000);
+
+        let guide = DataMgr.getSkillGuide();
+        if (guide == 1) {//非新手引导,就显示,否则不显示
+            console.log('zh:非新手引导,showInternAd  ');
+            JSBridgeUtils.instance.showInternAd('beginGame');
+        } else {
+            console.log('zh:新手引导,不显示AD  ');
+        }
+
+
+        console.log('zh:beginGame 2 go');
+        if (xGame.common.gameMode == GameMode.classic) {
+            //   xGame.uiMgr.Show(UIMsg, "Coming Soon")
+            if (isNice) {
+                //巅峰赛直接进入
+                this.enterClassic();
+            }
+            else {
+                xGame.uiMgr.Show(UIModeSelection, () => {
+                    console.log('zh:BBBBBBBBBBBBBBB');
+                    this.enterClassic();
+                })
+            }
+        }
+        else if (xGame.common.gameMode == GameMode.bigMove) {
+            this.ui.enterGuide.visible = false;
+            xGame.uiMgr.Show(UISkill);
+        }
+    }
+    enterClassic() {
+
+        xGame.uiMgr.Show(UIGame);
+        xGame.uiMgr.Show(UIMatching, () => {
+            if (!this.isHide) this.hide();
+            xGame.common.gameUI.ui.alpha = 1;
+            xGame.common.gameUI.startGame();
+            xGame.uiMgr.Hide(UIGameEnd);
+        });
+    }
+
+
+
+
+
+    startGlobal() {
+        xGame.uiMgr.Show(UIMsg, "Coming Soon")
+
+        //xGame.uiMgr.Show(UITry);
+        //  JSBridgeUtils.instance.showInternAd('');
+    }
+    startWeekly() {
+        //xGame.uiMgr.Show(UIBox);
+        xGame.uiMgr.Show(UIMsg, "Coming Soon")
+
+        //测试AD
+        // GlobalManager.instance.registerMethod('zhouSaiMonth', this.zhouSaiMonth);
+        //JSBridgeUtils.instance.showRewardAd('zhouSaiMonth');
+    }
+
+    zhouSaiMonth() {
+        console.log('zh:  zhouSaiMonth 被调用')
+    }
+    //网络资源是否准备好了
+    public isReadyForLoadNetSource(): boolean {
+        let reqCount = xGame.cfgMgr.httpReqCount;
+        let ok = xGame.cfgMgr.httpReqOkCount;
+        if (reqCount > ok) {
+            //console.log('zh:网络资源没有准备完成,请稍后再试');
+            xGame.uiMgr.Show(UIMsg, "Network not ready. Try again later.")
+            console.log('zh:✅❌  5秒后重新尝试加载网络资源');
+            Laya.timer.once(5000, this, () => {
+                let retryCount = 0;
+                const maxRetries = 3;
+
+                const tryFetchConfig = () => {
+                    try {
+                        xGame.cfgMgr.getConfigFromServer();
+                    } catch (error) {
+                        if (retryCount < maxRetries) {
+                            retryCount++;
+                            console.log(`🔄 第${retryCount}次重试获取配置...`);
+                            Laya.timer.once(5000, this, tryFetchConfig);
+                        } else {
+                            console.error("❌ 达到最大重试次数,配置获取失败");
+                        }
+                    }
+                };
+
+                tryFetchConfig();
+            });
+            return false;
+        }
+        return true;
+    }
+
+    startPlaceBall() {
+        if (!this.isReadyForLoadNetSource()) {
+            return;
+        }
+        xGame.uiMgr.Show(UILevelDisplay);
+    }
+    public hide(): void {
+        console.log('zh:uimain  hide ...');
+        //  console.log('zh:停止播放bjyy_m');
+        //xGame.soundMgr.stopSound("bjyy_m");
+
+
+        // console.log('zh: hide 停止播放主頁面背景音乐');
+        //  xGame.soundMgr.stopMusic();
+
+
+
+        super.hide();
+        xGame.common.stopGirlPop(this.ui.talkNode)
+    }
+    //点击头像
+    onGetUserInfo(force = false) {
+        if (Moyu.isWx) {
+            let info = Moyu.getSystemInfo();
+            if (info)
+                Moyu.createWXUserBtn(0, 0, info.width, info.height, 'res/wxuser.png', this.freshUser);
+        }
+        else {
+            Moyu.initUser(this, this.freshUser, force)
+        }
+        // if (!Moyu.hasUserInfo) {
+        //     let user = Moyu.getUserInfo();
+        //     //user.nickName="我";
+        //     user.headIcon = 'res/ty_touxiang.png';
+        //     //console.log("未授权");
+        // }
+        this.freshUser();
+
+
+
+
+    }
+    freshUser() {
+        let user = Moyu.getUserInfo();
+        if (!user.isAuth) {
+            user.headIcon = 'res/ty_touxiang.png';
+        }
+        else {
+            DataMgr.upRankData();
+        }
+        this.ui.headNode.nameTxt.text = xGame.tools.reviseString(user.nickName, 16);
+        xGame.common.createHead(this.ui.headNode.headRoot.headImg, user.headIcon);
+        let keyStr = keyForLoginInfo;
+        if (LocalStorageManager.hasJosnKey(keyStr)) {
+            const d = LocalStorageManager.getItem<{ username: string, token: string }>(keyStr);
+            let ua = d.username;
+            this.ui.headNode.nameTxt.text = xGame.tools.reviseString(ua, 16);
+        } else {
+
+        }
+       
+    }
+    interuptSecretary() {
+        Laya.timer.clearAll(this);
+        this.playSecretaryRandomSound();
+    }
+    //主界面和技能选择界面3-7秒未操作随机播放秘书音效
+    playSecretaryRandomSound() {
+        if (this.isHide) return;
+        let time = xGame.common.randomNum(45000, 60000);
+        Laya.timer.once(time, this, () => {
+            if (this.isHide) return;
+            let index = xGame.common.randomNum(4, 7);
+            xGame.soundMgr.playSound("s_main0" + index);
+            let words = 1;
+            switch (index) {
+                case 4:
+                    words = 5;
+                    break;
+                case 5:
+                    words = 3;
+                    break;
+                case 6:
+                    words = 6;
+                    break;
+                case 7:
+                    words = 7;
+                    break;
+
+                default:
+                    break;
+            }
+            xGame.common.showGirlTalkPop(words, this.ui.talkNode, this.ui.talkNode.womanTxt);
+            //
+            this.playSecretaryRandomSound();
+        })
+    }
+    openSecretaryView() {
+        xGame.uiMgr.Show(UISecretary);
+        Moyu.sendDataEvent("secretary");
+    }
+    openShopView() {
+        xGame.uiMgr.Show(UIShop, 0);
+    }
+    openSignView() {
+        xGame.uiMgr.Show(UISign);
+    }
+    openDrawView() {
+        xGame.uiMgr.Show(UIDraw);
+    }
+    openRanking() {
+        console.log('zh:phb  openRanking')
+        xGame.uiMgr.Show(UIRanking);
+        Moyu.sendDataEvent("rankingList");
+    }
+
+
+}
+UIMain.uiName = "UIMain";

+ 3 - 3
client/laya/src/ui/UILogin.ts

@@ -4,7 +4,7 @@ import { LocalStorageManager } from "../utils/LocalStorageManager";
 import { xGame } from "../xGame";
 import UIMsg from "./UIMsg";
 import UIReg from "./UIReg";
-
+import DataMgr from "../data/DataMgr";
 export default class UILogin extends UIBase {
     protected ui: ui_UILogin;
 
@@ -36,7 +36,7 @@ export default class UILogin extends UIBase {
         let up = this.ui.txt_up.text;
         // console.log('ua'+ua);
         if (ua && up) {
-           // xGame.uiMgr.Show(UIMsg, "Request in progress..")
+            // xGame.uiMgr.Show(UIMsg, "Request in progress..")
             let reqData = JSON.stringify({
                 username: ua.trim(),
                 password: up.trim(),
@@ -44,7 +44,6 @@ export default class UILogin extends UIBase {
             });
             xGame.httpMgr.sendPost2025('loginForApp', reqData, (res) => {
                 try {
-                    
                     console.log('zh:res = ' + JSON.stringify(res))
                     let code = res.code;
                     let msg = res.msg;
@@ -57,6 +56,7 @@ export default class UILogin extends UIBase {
                         }
                         LocalStorageManager.setItem(keyStr, jsonStr);
                         xGame.uiMgr.Show(UIMsg, msg)
+                        DataMgr.getUserZiChanInfo();
                         this.closeSelf();
                     } else {
                         xGame.uiMgr.Show(UIMsg, msg);

+ 2 - 3
client/laya/src/ui/UIMain.ts

@@ -174,6 +174,7 @@ export default class UIMain extends UIBase {
             console.log("zh:播放小秘书每天语音");
         }
         this.onGetUserInfo();
+        DataMgr.getUserZiChanInfo();
         this.ui.n83.visible = false;
         //万宁台球
         //Moyu.setShareInfo("8Ball Fury", ["台球", "台球", "桌球"], '2300002254');
@@ -581,11 +582,9 @@ export default class UIMain extends UIBase {
         //     //console.log("未授权");
         // }
         this.freshUser();
+    }
 
 
-
-
-    }
     freshUser() {
         let user = Moyu.getUserInfo();
         if (!user.isAuth) {

+ 35 - 45
client/laya/src/ui/item/DaoJuDisplay.ts

@@ -4,12 +4,12 @@ import DataMgr from "../../data/DataMgr";
 import { xGame } from "../../xGame";
 import UIAddProp from "../UIAddProp";
 import UIShop from "../UIShop";
+import UIMsg from "../UIMsg";
 import JSBridgeUtils from "../../utils/JSBridgeUtils";
 import ui_daoJuDisplay from "../../fgui/res/game/ui_daoJuDisplay";
-
+import { LocalStorageManager } from "../../utils/LocalStorageManager";
 export default class DaoJuDisplay {
     public ui: ui_daoJuDisplay;
-    //
 
     public index: number = 0;
     public uiIndex: number = 0;
@@ -25,7 +25,7 @@ export default class DaoJuDisplay {
         console.log('zh:' + JSON.stringify(data))
         this.ui.nameTxt.text = data.spbt;
         this.ui.n_jiaGe.text = data.spjg + "";
-        this.ui.n_zuanShi.text ="X"+ data.zssl + "";
+        this.ui.n_zuanShi.text = "X" + data.zssl + "";
 
         let baseUrl = "asset/sound/ogg/";
         this.ui.zsImg.url = xGame.common.getGameIconUrl(data.img);
@@ -39,50 +39,40 @@ export default class DaoJuDisplay {
         xGame.soundMgr.playSound(xGame.common.btnClickStr);
     }
     buySp() {
-        let data = cfgTable.daoJuData[this.index + 1];
-        console.log('zh:点击购买 data ='+JSON.stringify(data) );
-      
-        //let selectedIndex = this.ui.btn_buy.c1.selectedIndex;
-        // switch (selectedIndex) {
-        //     case 0:
-        //         //  console.log('zh:点击了 000000000000000');
-        //         break;
-        //     case 1:
-        //         console.log('zh:点击了 USE THIS');
-        //         DataMgr.setCurBallRod(this.index);
+        let djItem = cfgTable.daoJuData[this.index + 1];
+        console.log('zh:点击购买 djItem =' + JSON.stringify(djItem));
+        let userInfo = LocalStorageManager.getItem('userInfo');
+        if (userInfo == null) {
+            xGame.uiMgr.Show(UIMsg, 'Please log in to your account .');
+            // JSBridgeUtils.instance.showToast2('Please log in to your account .');
+            return;
+        }
+        let reqData = xGame.httpMgr.getReqData();
+        let pd: any = JSON.parse(reqData);
+        pd.spItem = djItem;
+        reqData = JSON.stringify(pd);
+        xGame.httpMgr.sendPost2025('user/buyZuanShi', reqData, (res) => {
+            try {
+                console.log('zh:buySp res = ' + JSON.stringify(res))
+                let code = res.code;
+                let msg = res.msg;
+                if (code == 200) {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                    //todo:之后开始重新从服务器获取用户资产信息
 
 
+                } else {
+                    xGame.uiMgr.Show(UIMsg, msg)
+                }
+                // if (Laya.Browser.onAndroid) {
+                //     JSBridgeUtils.instance.showToast2(msg);
+                // }
+            } catch (error) {
+                console.log('error=' + error);
+                alert(error);
+            } finally {
 
-        //         let curUse = DataMgr.getCurBallRod();
-        //         console.log('zh:updateSelf 选择的球杆 = ' + curUse);
-        //         let ui = <UIShop>xGame.uiMgr.getUI(UIShop);
-        //         ui.updateBallRod();
-        //         break;
-        //     case 2:
-        //         // console.log('zh:点击了 2222222222222');
-        //         let data = cfgTable.ballrodData[this.index + 1];
-        //         let need = data.price;
-        //         if (DataMgr.diamondEnough(need)) {
-        //             DataMgr.setDiamond(-need);
-        //             //
-        //             DataMgr.setBallRod(this.index, 1);
-        //             DataMgr.setCurBallRod(this.index);
-        //             //
-        //             let ui = <UIShop>xGame.uiMgr.getUI(UIShop);
-        //             ui.updateBallRod();
-        //             this.logEventForGouMaiGan(selectedIndex + '-' + data.name);
-        //         }
-        //         else {
-        //             xGame.uiMgr.Show(UIAddProp, 1);
-        //         }
-        //         break;
-
-        //     default:
-        //         break;
-        // }
+            }
+        });
     }
-
-
-
-
 }

+ 14 - 0
client/laya/src/utils/JSBridgeUtils.ts

@@ -252,6 +252,20 @@ export default class JSBridgeUtils {
 
 
 
+    /**
+     * 购买钻石
+     * @param msg 
+     * @returns 
+     */
+    // buyZuanShi(msg: string): String {
+    //     if (!Laya.Browser.onAndroid) {
+    //         return;
+    //     }
+    //     if (!this.initBridge()) {
+    //         return;
+    //     }
+    //     return this.bridge.call("buyZuanShi", msg);
+    // }
 
 
     nativeCallJs(msg: string) {

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott