Commit ba82ba8f authored by rockyl's avatar rockyl

Merge branch 'master' into component-lib

parents 6d0063d8 81f61b87
......@@ -7,6 +7,7 @@
import DialogContent from "../popup/DialogContent";
import {dynamic, Entity, resource} from "scilla";
import TextRenderer from "components/renderer/TextRenderer";
import {stringFixed} from "../game/utils";
export default class PKMatching extends DialogContent {
Title: Entity;
......@@ -36,8 +37,8 @@ export default class PKMatching extends DialogContent {
const {channel} = data;
this._titleRenderer.text = '正在匹配对手…';
this._selfNameRenderer.text = this.userNickname;
this._otherNameRenderer.text = this.otherName;
this._selfNameRenderer.text = stringFixed(this.userNickname);
this._otherNameRenderer.text = stringFixed(this.otherName);
this.AvatarOther.enabled = false;
this.AvatarWaiting.enabled = true;
......
......@@ -10,7 +10,7 @@ import Transform from "components/base/Transform";
import TextRenderer from "components/renderer/TextRenderer";
import TimesCard from "./TimesCard";
import RunNumber from "../common/RunNumber";
import {renderRunCredits} from "./utils";
import {renderRunCredits, stringFixed} from "./utils";
export default class PKResultAnimSide extends ScillaComponent {
LabelName: Entity;
......@@ -46,7 +46,7 @@ export default class PKResultAnimSide extends ScillaComponent {
const {nickname, receiveCredits, finalCredits, multipleCard} = data;
const showTimesCard = multipleCard > 0;
this._labelName.text = nickname;
this._labelName.text = stringFixed(nickname);
this._labelCredits.text = '';
this.TimesCard.enabled = false;
......
......@@ -4,14 +4,12 @@
* pk结果一侧
*/
import {Entity, resource} from "scilla";
import ScillaComponent from "components/base/ScillaComponent";
import {createTween, ease, engine, Entity, Tween} from "scilla";
import {createTween, ease, engine, Entity, resource} from "scilla";
import Transform from "components/base/Transform";
import TextRenderer from "components/renderer/TextRenderer";
import RunNumber from "../common/RunNumber";
import {renderRunCredits} from "./utils";
import {renderRunCredits, stringFixed} from "./utils";
import Zoom from "components/animation/Zoom";
import TextureRenderer from "components/renderer/TextureRenderer";
......@@ -63,7 +61,7 @@ export default class PKResultSide extends ScillaComponent {
async play(data) {
const {nickname, finalCredits, otherFinalCredits, resultState} = data;
this._labelName.text = nickname;
this._labelName.text = stringFixed(nickname);
this._labelCredits.text = renderRunCredits(finalCredits);
const win = resultState === this.side;
......
......@@ -26,3 +26,10 @@ export function isWeiXin() {
const ua = window.navigator.userAgent.toLowerCase();
return ua.includes('micromessenger');
}
export function stringFixed(str, limit = 6, mask = '…'){
if(str.length > limit){
return str.substr(0, limit) + mask;
}
return str;
}
......@@ -5,11 +5,7 @@
*/
import {EventEmitter} from 'scilla'
import {alien} from "./StackNavigator";
import NavigatorAction = alien.NavigatorAction;
import INavigatorDelegate = alien.INavigatorDelegate;
import StackNavigator = alien.StackNavigator;
import {INavigatorDelegate, NavigatorAction, StackNavigator} from "./StackNavigator";
export interface INavigatorViewBase {
onAddView(): boolean;
......
......@@ -4,18 +4,17 @@
* 堆栈导航器
*/
export module alien {
export enum NavigatorAction {Push, Pop, Replace, Jump}
export enum NavigatorAction {Push, Pop, Replace, Jump}
export interface INavigatorDelegate {
export interface INavigatorDelegate {
onEnter(name: string, last: string, action: NavigatorAction, parameters: any);
onLeave(name: string, next: string, action: NavigatorAction, parameters: any);
onError(error: Error);
}
}
export class StackNavigator {
export class StackNavigator {
private _stack: string[];
private _delegate: INavigatorDelegate;
......@@ -77,14 +76,14 @@ export module alien {
this.catchPromise(this._delegate.onEnter(name, last, NavigatorAction.Replace, parameters));
}
jump(name: string, parameters: any = null){
if(this._stack.length < 2){
jump(name: string, parameters: any = null) {
if (this._stack.length < 2) {
this.push(name, parameters);
return;
}
let last:string = this._stack.pop();
let last: string = this._stack.pop();
this._stack.splice(1);
let next:string = name;
let next: string = name;
this._stack.push(next);
this._delegate.onLeave(last, next, NavigatorAction.Pop, parameters);
this._delegate.onEnter(next, last, NavigatorAction.Pop, parameters);
......@@ -97,5 +96,4 @@ export module alien {
private getBottomSceneName(): string {
return this._stack.length > 0 ? this._stack[0] : null;
}
}
}
......@@ -5,11 +5,7 @@
*/
import {Entity, EventEmitter} from 'scilla'
import {alien} from "./StackNavigator";
import NavigatorAction = alien.NavigatorAction;
import INavigatorDelegate = alien.INavigatorDelegate;
import StackNavigator = alien.StackNavigator;
import {INavigatorDelegate, NavigatorAction, StackNavigator} from "./StackNavigator";
const showLog = false;
......
......@@ -64,7 +64,7 @@
logined: true, //是否登录 true是为登录
earnCreditsUrl: 'http://www.baidu.com', //加积分接口
unitName: '贝壳', //积分单位
userNickname: '超级登山包', //用户昵称
userNickname: '超级登山包超级登山包超级登山包', //用户昵称
showCredits: 1, //是否展示积分 1:展示 2:不展示
activityCode: '', //活动代码
configJson: '{"background":"//yun.duiba.com.cn/h5/miningMachine/home-bg.jpg","pk_button_normal":"//yun.duiba.com.cn/h5/miningMachine/pk-btn.png","pk_button_disabled":"//yun.duiba.com.cn/h5/miningMachine/pk-filter-btn.png","dig_button_normal":"//yun.duiba.com.cn/h5/miningMachine/mining-btn.png","dig_button_disabled":"//yun.dui88.com/h5/miningMachine/mining-filter-btn.png","dialog_background":"//yun.duiba.com.cn/h5/miningMachine/modal-bg.png","dialog_button":"//yun.duiba.com.cn/h5/miningMachine/modal-btn.png","pk_button_label_normal":"#FFF591","pk_button_label_disabled":"#666666","dig_button_label_normal":"#D12C00","dig_button_label_disabled":"#666666","dialog_text_color":"#AB5400","dialog_button_label":"#FFF591"}'
......
......@@ -8,6 +8,6 @@
"heapCredits":400,
"miningExpend":100,
"pkExpend":100,
"machineNickname1":"机器人昵称"
"machineNickname":"超级登山包超级登山包超级登山包"
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@
"machineReceiveCredits":50,
"machineMultipleCard":2,
"machineFinalCredits":100,
"machineNickname":"simba",
"machineNickname":"simbasimbasimbasimbasimba",
"machineAvatar":"Avengers",
"operationType":1
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment