Code standard
Server (GS: Java)JavaScript)
Collection
-
shortenedCollectionName = collectionName (collectionKey)
- eval = evaluation (studentUid)
- evalTeam = evaluationTeam (teamUid)
- result = results (simUid)
- sim = simulation (simUid)
- team = teams (teamU
- user = userdetails (userUid)
How to name Events (generic code)
- {Action}{Collection}{WhatItDoes} PascalCase
- GetSimGroup
- CreateTeam
- CreateSimCustomEval
- GetEvalScenario
- JoinSim
- JoinTeam
- ReopenSimYear
- EditUserStudent
How to get a Collection
-
var {shortenedCollectionName}Entry = API.getItem("{collectionName}", {collectionKey}).document();var {shortenedCollectionName}Data = {shortenedCollectionName}Entry.getData();
Set a Response
- use
sendMessageTo{Receiver}({specificToTheMethod}, {messageType}, {messageData})when you MODIFY data- messageType
- Actions
- deleted, changed, created
- {dataObject}_{field}_{action}
- ex.: team_cash_changed
- {dataObject}_{fieldOne}_{fieldTwo}_{etc.}_{action}
- ex.: sim_year_yearState_changed
- {dataObject}_{fieldParent}_{fieldChild}_{etc.}_{action}
- ex.: team_yearData_factory_changed
- Actions
-
messageData
- Information you want to send to the Client.
- send
teamUidand/orstudentUidwhen you send message to teacher (so that the teacher can filter the message)
- messageType
- use
Spark.setScriptData('{ObjectName}', {Object})when you GET data
Client (VS15.9.8: C#)
Standard
-
Cases
- Class PascalCase
- Methods PascalCase
- Private members _camelCase
- Public members camelCase
-
Document
-
Formatting order (each of those section should be surrounded by region with sub-region if necessary)
- Public members
- Public property
- Constructors
- Methods
- Private property
- Private Members
-
Formatting order (each of those section should be surrounded by region with sub-region if necessary)
- Whenever possible surround code with
#region MyRegion {code} #endregionto make the .cs clearer - use Stubs when the interface only need partial information instead of loading all the
datadata. - exemples : studentStub, EvalStudentStub.
- public : under public members
- private : over private members
- ex.:
private Dictionary<string, TextMeshProUGUI> TeamEvalTexts
{
get
{
if (_teamEvalTexts == null)
{
_teamEvalTexts = new Dictionary<string, TextMeshProUGUI>();
_teamEvalTexts[Simulation.SIM_PERF_NAME] = simPerfNoteText;
_teamEvalTexts[Simulation.LOGBOOK_NAME] = logbookNoteText;
}
return _teamEvalTexts;
}
}
private Dictionary<string, TextMeshProUGUI> _teamEvalTexts;
Data
- SetListeners in the data contructors
- the data Update itself and fire a relevent
Action - Filter the Response with
teamUidand/orstudentUidwhen the teacher receive the message
Client (Unity)
Boutons
Prefabs
Popup
Google sheetssheets