cc.Class({ extends: cc.Component, properties: { BDebug: { default: true, serializable: true, }, }, onLoad () { this.Host = 'https://www.9527fun.cn/Idol/'; this.ActionPower = 0; this.Golden = 0; this.Diamond = 0; this.Fans=0; this.FavorableImpression=0; //Course this.TalentTotalTime = 0; this.MakeUpTotalTime = 0; this.EloquenceTotalTime = 0; this.FashionTotalTime = 0; this.DanceTotalTime = 0; //Event this.VarietyShowTotalTime = 0; this.InterviewTotalTime = 0; this.MovieTotalTime = 0; this.HangOutTotalTime = 0; this.GirlAnimations = ['Idle']; }, GetGameConfig(CallBack) { let URL = this.Host+'GameConfig/GetGameConfig'; let XHR = new XMLHttpRequest(); XHR.onreadystatechange = function () { if (XHR.readyState == 4 && (XHR.status >= 200 && XHR.status < 400)) { let response = XHR.responseText; // console.log(response); let ResultJson = JSON.parse(response); // console.log(ResultJson); // Game let GameConfig = ResultJson.GameConfig; // console.log(GameConfig); this.ActionPower = GameConfig.ActionPower; this.Coin = GameConfig.Coin; this.Diamond = GameConfig.Diamond; this.Fans=GameConfig.Fans; this.FavorableImpression=GameConfig.FavorableImpression; // Course let CourseConfig = ResultJson.CourseConfig; // console.log(CourseConfig); this.TalentTotalTime = CourseConfig.TalentTotalTime; this.MakeUpTotalTime = CourseConfig.MakeUpTotalTime; this.EloquenceTotalTime = CourseConfig.EloquenceTotalTime; this.FashionTotalTime = CourseConfig.FashionTotalTime; this.DanceTotalTime = CourseConfig.DanceTotalTime; //Event let EventConfig = ResultJson.EventConfig; this.VarietyShowTotalTime = EventConfig.VarietyShowTotalTime; this.InterviewTotalTime = EventConfig.InterviewTotalTime; this.MovieTotalTime = EventConfig.MovieTotalTime; this.HangOutTotalTime = EventConfig.HangOutTotalTime; CallBack(); } }.bind(this); XHR.open("GET", URL, true); XHR.setRequestHeader("Content-Type" , "application/json"); XHR.send(); } });