Skip to content

Scene Class

Komefai edited this page Jan 7, 2018 · 8 revisions

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)
    {
        if (!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).


CreateID

public static string CreateID(Scene instance, string name)

Create a unique ID for a scene. Format: $"{instance.Name}_{name}"