Scene Class - komefai/PS4Macro GitHub Wiki
Scene is the base class for all scenes.
Syntax
public abstract class Scene
Example
class MissionSelect : Scene
{
public override string Name => "Mission Select";
public static RectMap RandomMission = new RectMap
{
ID = "MissionSelect|RandomMission",
Hash = 179719840936639549,
X = 166,
Y = 179,
Width = 219,
Height = 118
};
public static PixelMap ReplaySelected = new PixelMap
{
ID = "MissionSelect|ReplaySelected",
X = 387,
Y = 445,
Color = 0xFFFFFF
};
public override bool Match(ScriptBase script)
{
return script.MatchTemplate(RandomMission, 92);
}
public override void OnMatched(ScriptBase script)
{
var _script = script as MainScript;
if (_script.ShouldMove && !script.MatchTemplate(ReplaceSelected))
{
script.Press(new DualShockState() { DPad_Up = true }, 100);
}
script.Sleep(1000);
script.Press(new DualShockState() { Cross = true }, 250);
}
}
Abstract Properties
You should override these properties.
Name
abstract public string Name { get; }
Name of the scene.
Abstract Methods
You should override these methods.
Match
abstract public bool Match(ScriptBase script);
Test a condition to match this scene.
OnMatched
abstract public void OnMatched(ScriptBase script);
Called when the scene is matched.
Static Methods
Search
public static Scene Search(ScriptBase script)
Sort by search priority (frequent scenes first). This method will go through the Script's Config.Scenes
list in order and call Match() until a match is found.