-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 添加Build上传功能(试运行),可以通过点击详情页的网上配置按钮浏览自己和他人分享的内容
2. 资源文件合并至20220106 3. 修复 劣势性格突破时,竞技场档位计算不准确的问题 4. 修复 部分锻造武器翻译不显示的问题 5. 整合详情页的操作到一个按钮
- Loading branch information
jay
committed
Jan 6, 2022
1 parent
485df74
commit 7a6de0b
Showing
31 changed files
with
1,479 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:cloud_db/cloud_db.dart'; | ||
|
||
import 'like_table.dart'; | ||
|
||
class HeroBuildTable extends BTable { | ||
HeroBuildTable({ | ||
this.creator, | ||
this.title, | ||
this.build, | ||
this.idTag, | ||
this.likes, | ||
// this.dislikes, | ||
this.tags, | ||
ACL? acl, | ||
String? objectId, | ||
DateTime? updatedAt, | ||
DateTime? createdAt, | ||
bool useDefaultAcl = true, | ||
}) : super( | ||
acl: acl ?? ACL(), | ||
objectId: objectId, | ||
createdAt: createdAt, | ||
updatedAt: updatedAt, | ||
useDefaultAcl: useDefaultAcl, | ||
); | ||
String? creator; | ||
String? title; | ||
String? build; | ||
String? idTag; | ||
BPointer<LikeTable>? likes; | ||
// BPointer<DislikeTable>? dislikes; | ||
BArray<String>? tags; | ||
|
||
static const String table = "hero_build"; | ||
|
||
@override | ||
String get tableName => table; | ||
|
||
@override | ||
Map<String, dynamic> toJson() { | ||
return { | ||
"creator": creator, | ||
"title": title, | ||
"build": build, | ||
"id_tag": idTag, | ||
"likes": likes?.toJson(), | ||
// "dislikes": dislikes?.toJson(), | ||
"tags": tags?.toJson(), | ||
}; | ||
} | ||
|
||
@override | ||
String toString() { | ||
return jsonEncode(toJson()); | ||
} | ||
|
||
factory HeroBuildTable.fromJson(Map<String, dynamic> json) { | ||
return HeroBuildTable()..fromJson(json); | ||
} | ||
|
||
/// 新增一个build | ||
Future<PostResult> create() async { | ||
// var r = await Batch(tasks: [ | ||
// BatchTask( | ||
// method: BatchMethod.POST, | ||
// path: "/1/classes/likes", | ||
// body: {"count": 0}, | ||
// ), | ||
// BatchTask( | ||
// method: BatchMethod.POST, | ||
// path: "/1/classes/dislikes", | ||
// body: {"count": 0}, | ||
// ), | ||
// ]).doTasks(); | ||
var r = await LikeTable(count: 0).post(); | ||
likes = BPointer(className: "likes", objectId: r.objectId!); | ||
// dislikes = BPointer( | ||
// className: "dislikes", objectId: (r[1].result as PostResult).objectId!); | ||
var _r = await post(); | ||
return _r; | ||
} | ||
|
||
/// 点赞/踩一个BUILD | ||
/// | ||
/// [isLike] 表示操作类型:1赞 2踩 0取消 | ||
/// | ||
/// [isPlus]代表操作,true+1 false-1 | ||
// Future likeBuild(int isLike, bool isPlus) async { | ||
// if (objectId != null && likes != null) { | ||
// var r = await Batch(tasks: [ | ||
// // favorite添加一条记录 | ||
// BatchTask( | ||
// method: BatchMethod.POST, | ||
// path: "/1/classes/favorite", | ||
// body: { | ||
// "user": Cloud().currentUser.username, | ||
// "type": isLike, | ||
// "build": | ||
// BPointer(className: "hero_build", objectId: objectId!).toJson(), | ||
// }, | ||
// ), | ||
// // likes表+/-1 | ||
// BatchTask( | ||
// method: BatchMethod.PUT, | ||
// path: "/1/classes/likes/${likes!.objectId}", | ||
// body: { | ||
// "count": {"__op": "Increment", "amount": isPlus ? 1 : -1} | ||
// }, | ||
// ), | ||
// ]).doTasks(); | ||
// } | ||
// } | ||
|
||
@override | ||
void fromJson(Map<String, dynamic> json) { | ||
creator = json["creator"]; | ||
title = json["title"]; | ||
build = json["build"]; | ||
idTag = json["id_tag"]; | ||
|
||
likes = json["likes"] != null | ||
? BPointer.fromJson(json["likes"], (json) => LikeTable.fromJson(json)) | ||
: null; | ||
// dislikes = BPointer.fromJson( | ||
// json["dislikes"], (json) => DislikeTable.fromJson(json)); | ||
tags = BArray.fromJson((json["tags"] as List? ?? []).cast<String>()); | ||
|
||
// 父属性 | ||
acl = ACL.fromJson(json["ACL"]); | ||
// ? [objectId] 是否应该允许覆盖? | ||
objectId = json["objectId"]; | ||
createdAt = DateTime.tryParse(json["createdAt"] ?? ""); | ||
updatedAt = DateTime.tryParse(json["updatedAt"] ?? ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import 'package:cloud_db/cloud_db.dart'; | ||
|
||
import 'build_table.dart'; | ||
|
||
class FavoriteTable extends BTable { | ||
FavoriteTable({ | ||
this.build, | ||
this.user, | ||
this.type, | ||
ACL? acl, | ||
String? objectId, | ||
DateTime? updatedAt, | ||
DateTime? createdAt, | ||
bool useDefaultAcl = false, | ||
}) : super( | ||
acl: acl ?? ACL(), | ||
objectId: objectId, | ||
createdAt: createdAt, | ||
updatedAt: updatedAt, | ||
useDefaultAcl: useDefaultAcl, | ||
); | ||
BPointer<HeroBuildTable>? build; | ||
String? user; | ||
int? type; | ||
|
||
@override | ||
void fromJson(Map<String, dynamic> json) { | ||
build = json["build"] != null | ||
? BPointer.fromJson( | ||
json["build"], (json) => HeroBuildTable.fromJson(json)) | ||
: null; | ||
user = json["user"]; | ||
type = json["type"]; | ||
|
||
acl = ACL.fromJson(json["ACL"]); | ||
// ? [objectId] 是否应该允许覆盖? | ||
objectId = json["objectId"]; | ||
createdAt = DateTime.tryParse(json["createdAt"] ?? ""); | ||
updatedAt = DateTime.tryParse(json["updatedAt"] ?? ""); | ||
} | ||
|
||
factory FavoriteTable.fromJson(Map<String, dynamic> json) => | ||
FavoriteTable()..fromJson(json); | ||
|
||
@override | ||
String get tableName => "favorite"; | ||
|
||
@override | ||
Map<String, dynamic> toJson() => { | ||
"user": user, | ||
"type": type, | ||
"build": build?.toJson(), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:cloud_db/cloud_db.dart'; | ||
|
||
class LikeTable extends BTable { | ||
LikeTable({ | ||
this.count, | ||
ACL? acl, | ||
String? objectId, | ||
DateTime? updatedAt, | ||
DateTime? createdAt, | ||
bool useDefaultAcl = false, | ||
}) : super( | ||
acl: acl ?? ACL(), | ||
objectId: objectId, | ||
createdAt: createdAt, | ||
updatedAt: updatedAt, | ||
useDefaultAcl: useDefaultAcl, | ||
); | ||
int? count; | ||
@override | ||
void fromJson(Map<String, dynamic> json) { | ||
count = json["count"]; | ||
acl = ACL.fromJson(json["ACL"]); | ||
// ? [objectId] 是否应该允许覆盖? | ||
objectId = json["objectId"]; | ||
createdAt = DateTime.tryParse(json["createdAt"] ?? ""); | ||
updatedAt = DateTime.tryParse(json["updatedAt"] ?? ""); | ||
} | ||
|
||
factory LikeTable.fromJson(Map<String, dynamic> json) => | ||
LikeTable()..fromJson(json); | ||
|
||
@override | ||
String get tableName => "likes"; | ||
|
||
@override | ||
Map<String, dynamic> toJson() => {"count": count}; | ||
|
||
Future<void> countChange(bool plus) async { | ||
await put({ | ||
"count": {"__op": "Increment", "amount": plus ? 1 : -1} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import 'controller.dart'; | ||
|
||
class HeroBuildShareBinding extends Bindings { | ||
HeroBuildShareBinding(); | ||
|
||
@override | ||
void dependencies() { | ||
Get.lazyPut(() => HeroBuildSharePageController()); | ||
} | ||
} |
Oops, something went wrong.