This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from CPCTF2022/fix-path
Fix path
- Loading branch information
Showing
15 changed files
with
122 additions
and
43 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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,79 @@ | ||
export class CircuitServerBasisInfo { | ||
constructor(public sizeX: number, public sizeY: number) {} | ||
} | ||
|
||
export class CircuitServerPartsInfo { | ||
constructor( | ||
public x: number, | ||
public z: number, | ||
public isBig: boolean, | ||
public category: string | ||
) {} | ||
} | ||
|
||
export class CircuitServerWiresInfo { | ||
constructor( | ||
public x: number, | ||
public z: number, | ||
public wires: [number, number][] | ||
) {} | ||
} | ||
|
||
export class CircuitServerInfoUtils { | ||
static jsonToInfo( | ||
json: string | ||
): [ | ||
CircuitServerBasisInfo, | ||
CircuitServerPartsInfo[], | ||
CircuitServerWiresInfo[] | ||
] { | ||
const objs = JSON.parse(json) as ICircuitServer[] | ||
let basisInfo: CircuitServerBasisInfo = new CircuitServerBasisInfo(0, 0) | ||
const partsInfos: CircuitServerPartsInfo[] = new Array(0) | ||
const wiresInfos: CircuitServerWiresInfo[] = new Array(0) | ||
objs.forEach(obj => { | ||
if (obj.class == 'basis') { | ||
const basis = obj as IBasisInfo | ||
basisInfo = new CircuitServerBasisInfo(basis.sizeX, basis.sizeY) | ||
} else if (obj.class == 'parts') { | ||
const parts = obj as IPartsInfo | ||
partsInfos.push( | ||
new CircuitServerPartsInfo( | ||
parts.x, | ||
parts.z, | ||
parts.isBig, | ||
parts.category | ||
) | ||
) | ||
} else if (obj.class == 'wires') { | ||
const wires = obj as IWiresInfo | ||
wiresInfos.push( | ||
new CircuitServerWiresInfo(wires.x, wires.z, wires.wires) | ||
) | ||
} | ||
}) | ||
return [basisInfo, partsInfos, wiresInfos] | ||
} | ||
} | ||
|
||
interface ICircuitServer { | ||
class: string | ||
} | ||
|
||
interface IBasisInfo extends ICircuitServer { | ||
sizeX: number | ||
sizeY: number | ||
} | ||
|
||
interface IPartsInfo extends ICircuitServer { | ||
x: number | ||
z: number | ||
isBig: boolean | ||
category: string | ||
} | ||
|
||
interface IWiresInfo extends ICircuitServer { | ||
x: number | ||
z: number | ||
wires: [number, number][] | ||
} |
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