浏览代码

demo

master
peter 5 年前
父节点
当前提交
6930e2245f

+ 1
- 0
src/backend/Types/Types.ts 查看文件

@@ -35,6 +35,7 @@ export type TableDefiniton = {
35 35
 }
36 36
 
37 37
 export type Race = "Human" | "Gnome" | "Night Elf" | "Dwarf"
38
+export const _Race: Race[] =["Human", "Gnome", "Night Elf", "Dwarf"]
38 39
 export type Rank =             "ADMIN" | "Guildmaster" | "Officer" | "Classleader" | "Raider" | "Trial" | "Social" | "Guest"
39 40
 export const _Rank : Rank[] = ["ADMIN" , "Guildmaster" , "Officer" , "Classleader" , "Raider" , "Trial" , "Social" , "Guest"]
40 41
 export type Class =              "Warrior" | "Rogue" | "Hunter" | "Mage" | "Warlock" | "Priest" | "Shaman" | "Paladin" | "Druid"

+ 7
- 5
src/frontend/src/app/frontcraft/auth/register/register.component.html 查看文件

@@ -41,11 +41,14 @@
41 41
 
42 42
   <nb-card>
43 43
     <nb-card-body>
44
-      <nb-checkbox [(ngModel)]="showApplication" name="amMember" #checkbox>I am already a member</nb-checkbox>
44
+      <nb-checkbox [(ngModel)]="showApplication" name="amMember" #checkbox><!--I am already a member-->I understand this is super beta and things might not work or are not very pretty</nb-checkbox>
45 45
       <br />
46 46
       
47
-      <span *ngIf="showApplication">
47
+      <span > <!--*ngIf="showApplication"-->
48 48
         And my main is &nbsp; <input name="preMember" [(ngModel)]="character.name"  nbInput>, a 
49
+        <nb-select [(selected)]="character.race" placeholder="Race" (selectedChange)="onSelectRace()">
50
+          <nb-option *ngFor="let race of races" [value]="race">{{race}}</nb-option>
51
+        </nb-select>
49 52
         <nb-select [(selected)]="character.spec" placeholder="Spec" (selectedChange)="onSelectSpec()">
50 53
           <nb-option *ngFor="let spec of specs" [value]="spec">{{spec}}</nb-option>
51 54
         </nb-select>
@@ -57,7 +60,7 @@
57 60
           <nb-option *ngFor="let rank of ranks" [value]="rank" >{{rank}}</nb-option>
58 61
         </nb-select>
59 62
       </span>
60
-
63
+      <!--
61 64
       <span *ngIf="!showApplication">Hello my name is &nbsp; <input name="charName" [(ngModel)]="character.name" nbInput>
62 65
         I am playing a level 60 
63 66
         <nb-select [(selected)]="character.spec" placeholder="Spec" (selectedChange)="onSelectSpec()">
@@ -68,9 +71,8 @@
68 71
         </nb-select>
69 72
         and I would like to join Tranquil because
70 73
         <textarea nbInput fullWidth placeholder="reason" style="min-height: 400px"></textarea>
71
-
72 74
       </span>
73
-
75
+      -->
74 76
     </nb-card-body>
75 77
   </nb-card>
76 78
 

+ 7
- 3
src/frontend/src/app/frontcraft/auth/register/register.component.ts 查看文件

@@ -1,7 +1,7 @@
1 1
 import { Component, OnInit } from '@angular/core';
2 2
 import { ApiService as ApiService, hash } from '../../services/login-api';
3 3
 import { Router } from '@angular/router';
4
-import { _Rank, _Class, Class, User  } from '../../../../../../backend/Types/Types'
4
+import { _Rank, _Class, Class, User, _Race  } from '../../../../../../backend/Types/Types'
5 5
 import { specs  } from '../../../../../../backend/Types/PlayerSpecs'
6 6
 import { race } from 'rxjs';
7 7
 
@@ -18,11 +18,13 @@ export class RegisterComponent implements OnInit{
18 18
 
19 19
   character: any = {
20 20
     class : "Warrior",
21
-    spec : "Arms"
21
+    spec : "Arms",
22
+    race: "Night Elf"
22 23
   }
23 24
 
24 25
   ranks = _Rank
25 26
   classes = _Class
27
+  races  = _Race
26 28
   selectedClass : Class = "Warrior"
27 29
   selectedSpec = specs[this.selectedClass][0]
28 30
   specs = specs[this.selectedClass]
@@ -51,6 +53,8 @@ export class RegisterComponent implements OnInit{
51 53
   onSelectSpec(){
52 54
   }
53 55
 
56
+  onSelectRace(){}
57
+
54 58
   async onSubmit(){
55 59
     const pw = this.user.pwhash
56 60
     this.user.pwhash = await hash(this.user.pwhash)
@@ -76,7 +80,7 @@ export class RegisterComponent implements OnInit{
76 80
         charactername: char.name,
77 81
         specid: specid,
78 82
         userid: this.api.getAuth().user.id!,
79
-        race: 'Human'
83
+        race: char.race
80 84
       })
81 85
     }catch(e){
82 86
       alert("Error creating character"+e)

+ 1
- 1
src/frontend/src/app/frontcraft/pages/shop/buytoken.component.ts 查看文件

@@ -99,7 +99,7 @@ import { _Tiers, allItems, Tiers } from '../../../../../../backend/Types/Items';
99 99
         const token = await src.buyToken(this.api.getAuth().token.value, charactername, this.item.itemname, this.signup)
100 100
     
101 101
         if(token){
102
-        this.toastr.show(token.characterid+' now has a token for '+token.itemname+' of level '+token.level, 'Yay', {status: 'success'})
102
+        this.toastr.show(token.charactername+' now has a token for '+token.itemname+' of level '+token.level, 'Yay', {status: 'success'})
103 103
         }else{
104 104
         this.toastr.show('Error (something went wrong)', 'Oh no', {status: 'danger'})
105 105
         }

正在加载...
取消
保存