2019-10-18 17:26:34 -07:00
|
|
|
/**
|
|
|
|
|
* This class stores the handlers for the individual checkboxes available in the developer overlay.
|
|
|
|
|
* Such a class must have label and onPress function.
|
|
|
|
|
* If the class has a checked property, then that will be called every simulation update to
|
|
|
|
|
* synchronize the state of the checkbox (only if the developer overaly is opened).
|
|
|
|
|
*/
|
2021-11-12 03:22:18 -08:00
|
|
|
class DeveloperOverlayControlCheckboxes
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.ControlAll = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Control all units");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.PostNetworkCommand({
|
|
|
|
|
"type": "control-all",
|
|
|
|
|
"flag": checked
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
2025-05-10 07:50:42 -07:00
|
|
|
const playerState = g_SimState.players[g_ViewedPlayer];
|
2019-10-18 17:26:34 -07:00
|
|
|
return playerState ? playerState.controlsAll : false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.ChangePerspective = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
constructor(playerViewControl)
|
|
|
|
|
{
|
|
|
|
|
this.playerViewControl = playerViewControl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Change perspective");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
this.playerViewControl.setChangePerspective(checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.SelectionEntityState = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
constructor(playerViewControl, selection)
|
|
|
|
|
{
|
|
|
|
|
this.developerOverlayEntityState = new DeveloperOverlayEntityState(selection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Display selection state");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
this.developerOverlayEntityState.setEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.PathfinderOverlay = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Pathfinder overlay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GuiInterfaceCall("SetPathfinderDebugOverlay", checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.HierarchicalPathfinderOverlay = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Hierarchical pathfinder overlay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GuiInterfaceCall("SetPathfinderHierDebugOverlay", checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.ObstructionOverlay = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Obstruction overlay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GuiInterfaceCall("SetObstructionDebugOverlay", checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.UnitMotionOverlay = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Unit motion overlay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
g_Selection.SetMotionDebugOverlay(checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.RangeOverlay = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Range overlay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GuiInterfaceCall("SetRangeDebugOverlay", checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.BoundingBoxOverlay = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Bounding box overlay");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.SetBoundingBoxDebugOverlay(checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.RestrictCamera = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Restrict camera");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GameView_SetConstrainCameraEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return Engine.GameView_GetConstrainCameraEnabled();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.RevealMap = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Reveal map");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.PostNetworkCommand({
|
|
|
|
|
"type": "reveal-map",
|
|
|
|
|
"enable": checked
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return Engine.GuiInterfaceCall("IsMapRevealed");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.EnableTimeWarp = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
constructor()
|
|
|
|
|
{
|
|
|
|
|
this.timeWarp = new TimeWarp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Enable time warp");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
this.timeWarp.setEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-12-17 09:53:13 -08:00
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.ActivateRejoinTest = class
|
2020-12-17 09:53:13 -08:00
|
|
|
{
|
|
|
|
|
constructor()
|
|
|
|
|
{
|
|
|
|
|
this.disabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Activate Rejoin Test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
2025-05-10 07:50:42 -07:00
|
|
|
const box = new SessionMessageBox();
|
2020-12-17 09:53:13 -08:00
|
|
|
box.Title = "Rejoin Test";
|
|
|
|
|
box.Caption = "Warning: the rejoin test can't be de-activated and is quite slow. Its only purpose is to check for OOS.";
|
2025-05-10 07:50:42 -07:00
|
|
|
const self = this;
|
2020-12-17 09:53:13 -08:00
|
|
|
box.Buttons = [
|
2025-12-30 00:57:37 -08:00
|
|
|
{ "caption": "Cancel" }, { "caption": "OK", "onPress": () =>
|
|
|
|
|
{
|
2020-12-17 09:53:13 -08:00
|
|
|
Engine.ActivateRejoinTest();
|
|
|
|
|
this.disabled = true;
|
|
|
|
|
this.update();
|
|
|
|
|
} }
|
|
|
|
|
];
|
|
|
|
|
box.display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return this.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enabled()
|
|
|
|
|
{
|
2021-03-19 03:02:10 -07:00
|
|
|
return !this.disabled && g_InitAttributes.mapType != "random";
|
2020-12-17 09:53:13 -08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.PromoteSelectedUnits = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Promote selected units");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.PostNetworkCommand({
|
|
|
|
|
"type": "promote",
|
|
|
|
|
"entities": g_Selection.toList()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.EnableCulling = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Enable culling");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GameView_SetCullingEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return Engine.GameView_GetCullingEnabled();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.LockCullCamera = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Lock cull camera");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.GameView_SetLockCullCameraEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return Engine.GameView_GetLockCullCameraEnabled();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.DisplayCameraFrustum = class
|
2019-10-18 17:26:34 -07:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Display camera frustum");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.Renderer_SetDisplayFrustumEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return Engine.Renderer_GetDisplayFrustumEnabled();
|
|
|
|
|
}
|
|
|
|
|
};
|
2020-01-14 15:51:29 -08:00
|
|
|
|
2021-11-12 03:22:18 -08:00
|
|
|
DeveloperOverlayControlCheckboxes.prototype.DisplayShadowsFrustum = class
|
2020-01-14 15:51:29 -08:00
|
|
|
{
|
|
|
|
|
label()
|
|
|
|
|
{
|
|
|
|
|
return translate("Display shadows frustum");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPress(checked)
|
|
|
|
|
{
|
|
|
|
|
Engine.Renderer_SetDisplayShadowsFrustumEnabled(checked);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked()
|
|
|
|
|
{
|
|
|
|
|
return Engine.Renderer_GetDisplayShadowsFrustumEnabled();
|
|
|
|
|
}
|
|
|
|
|
};
|