Skip to main content
Code standard
Server (GS: Java)
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}
{dataObject}_{fieldOne}_{fieldTwo}_{etc.}_{action}
ex.: sim_year_yearState_changed
{dataObject}_{fieldParent}_{fieldChild}_{etc.}_{action}
ex.: team_yearData_factory_changed
messageData
Information you want to send to the Client .
send teamUid and/or studentUid when you send message to teacher (so that the teacher can filter the message)
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
Whenever possible surround code with #region MyRegion {code } #endregion to make the .cs clearer
use Stubs when the interface only need partial information instead of loading all the data
if you want to do Lazy loading or Lazy Initialization make a Property (the reference is always private)
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 teamUid and/or studentUid when the teacher receive the message
Client (Unity)
Boutons
Google sheets ()