添加微信云开发环境
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "c30e017c-de95-4d76-bb05-0c94dd531ab0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -7,20 +7,28 @@ import { UIConfigData } from './game/common/config/GameUIConfig';
|
||||
import { smc } from './game/common/SingletonModuleComp';
|
||||
import { Initialize } from './game/initialize/Initialize';
|
||||
import { EcsPositionSystem } from './game/common/ecs/position/EcsPositionSystem';
|
||||
import { WxCloudApi } from './game/wx_clound_client_api/WxCloudApi';
|
||||
// import { WxCloudApi } from './game/wx_clound_client_api/WxCloudApi';
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
// WxCloudApi.init("cloud1-6gknw0qk911036d8")
|
||||
@ccclass('Main')
|
||||
export class Main extends Root {
|
||||
|
||||
start() {
|
||||
if(this.isWxClient()){
|
||||
WxCloudApi.init("cloud1-6gknw0qk911036d8")
|
||||
}
|
||||
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb |
|
||||
EPhysics2DDrawFlags.Pair
|
||||
// EPhysics2DDrawFlags.CenterOfMass |
|
||||
// EPhysics2DDrawFlags.Joint |
|
||||
// EPhysics2DDrawFlags.Shape;
|
||||
}
|
||||
private isWxClient(): boolean {
|
||||
// 检查是否存在微信API
|
||||
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function';
|
||||
}
|
||||
protected async run() {
|
||||
smc.initialize = ecs.getEntity<Initialize>(Initialize);
|
||||
smc.vmAdd()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Color, Component, EventTouch, sp, Vec3, _decorator ,} from "cc";
|
||||
import { Color, Component, EventTouch, Vec3, _decorator ,} from "cc";
|
||||
import HeroAnmComp from "./HeroAnmComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { LoadingViewComp } from "./view/LoadingViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { WxCloudApi } from "../wx_clound_client_api/WxCloudApi";
|
||||
|
||||
|
||||
// import {data} from "../data/data";
|
||||
@@ -50,6 +51,10 @@ export class Initialize extends ecs.Entity {
|
||||
oops.res.load("language/font/" + oops.language.current, () => {
|
||||
// 加载本地英雄数据
|
||||
this.loadHeroDataFromLocal();
|
||||
// 判断是否为微信客户端,是的话才加载云端数据
|
||||
if (this.isWxClient()) {
|
||||
this.loadWxDataFromCloud();
|
||||
}
|
||||
next();
|
||||
});
|
||||
//加载精灵配置表
|
||||
@@ -83,7 +88,19 @@ export class Initialize extends ecs.Entity {
|
||||
oops.res.loadDir("common", next);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 判断是否为微信客户端
|
||||
*/
|
||||
private isWxClient(): boolean {
|
||||
// 检查是否存在微信API
|
||||
return typeof wx !== 'undefined' && typeof (wx as any).getSystemInfoSync === 'function';
|
||||
}
|
||||
|
||||
private loadWxDataFromCloud() {
|
||||
WxCloudApi.login().then(loginRes=>{
|
||||
console.log("login res", loginRes);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 从本地存储加载游戏数据
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator,Collider2D ,Contact2DType,v3,IPhysics2DContact,Vec3, tween, math, RigidBody2D, Animation, sp, Tween} from "cc";
|
||||
import { _decorator,Collider2D ,Contact2DType,v3,IPhysics2DContact,Vec3, tween, math, RigidBody2D, Animation, Tween} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
@@ -50,7 +50,6 @@ export class SkillCom extends CCComp {
|
||||
debuff_value:number=0;
|
||||
debuff_count:number=0;
|
||||
// 组件引用
|
||||
spine:sp.Skeleton=null;
|
||||
anim:Animation=null;
|
||||
tweenInstance:Tween<any> = null;
|
||||
private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向
|
||||
@@ -82,11 +81,9 @@ export class SkillCom extends CCComp {
|
||||
this.initializeSkillConfig();
|
||||
if (!this.skillConfig) return;
|
||||
this.node.setPosition(this.startPos.x,this.startPos.y,0)
|
||||
if(this.node.getChildByName('anm')){
|
||||
this.spine=this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
|
||||
}else{
|
||||
this.anim=this.node.getComponent(Animation)
|
||||
}
|
||||
|
||||
this.anim=this.node.getComponent(Animation)
|
||||
|
||||
this.on(GameEvent.MissionEnd, this.doDestroy, this);
|
||||
this.node.active = true;
|
||||
//console.log("[SkillCom]:caster",this.caster)
|
||||
@@ -149,15 +146,7 @@ export class SkillCom extends CCComp {
|
||||
//console.log("[SkillCom]:has anim",anim)
|
||||
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
if(this.node.getChildByName('anm')){
|
||||
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||
//console.log("[SkillCom]:has spine",this.spine)
|
||||
this.spine.setCompleteListener((trackEntry) => {
|
||||
this.onAnimationFinished()
|
||||
//console.log("[SkillCom]:[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
onAnimationFinished(){
|
||||
// console.log("[SkillCom]:onAnimationFinished",this.s_uuid)
|
||||
@@ -233,12 +222,10 @@ export class SkillCom extends CCComp {
|
||||
}
|
||||
|
||||
if(smc.mission.pause) {
|
||||
if(this.spine) this.spine.paused=true
|
||||
if(this.anim) this.anim.pause()
|
||||
return;
|
||||
}
|
||||
if(this.anim) this.anim.resume()
|
||||
if(this.spine) this.spine.paused=false
|
||||
if (!this.node || !this.node.isValid) return;
|
||||
|
||||
if(this.skillConfig.EType==EType.timeEnd){
|
||||
|
||||
Reference in New Issue
Block a user