Example #1
0
    // Use this for initialization
    void Start()
    {
        // Init Keyboard mapping
        _keyMapping = new Dictionary <KeyCode, EmulatorBase.Button>();
        _keyMapping.Add(KeyCode.UpArrow, EmulatorBase.Button.Up);
        _keyMapping.Add(KeyCode.DownArrow, EmulatorBase.Button.Down);
        _keyMapping.Add(KeyCode.LeftArrow, EmulatorBase.Button.Left);
        _keyMapping.Add(KeyCode.RightArrow, EmulatorBase.Button.Right);
        _keyMapping.Add(KeyCode.Z, EmulatorBase.Button.A);
        _keyMapping.Add(KeyCode.X, EmulatorBase.Button.B);
        _keyMapping.Add(KeyCode.Space, EmulatorBase.Button.Start);
        _keyMapping.Add(KeyCode.LeftShift, EmulatorBase.Button.Select);


        // Load emulator
        IVideoOutput drawable   = new DefaultVideoOutput();
        IAudioOutput audio      = GetComponent <DefaultAudioOutput>();
        ISaveMemory  saveMemory = new DefaultSaveMemory();

        Emulator = new Emulator(drawable, audio, saveMemory);
        ScreenRenderer.material.mainTexture = ((DefaultVideoOutput)Emulator.Video).Texture;

        gameObject.GetComponent <AudioSource>().enabled = false;
        StartCoroutine(LoadRom(Filename));
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        // Init Keyboard mapping
        _keyMapping = new Dictionary <KeyCode, EmulatorBase.Button>();
        _keyMapping.Add(KeyCode.W, EmulatorBase.Button.Up);
        _keyMapping.Add(KeyCode.S, EmulatorBase.Button.Down);
        _keyMapping.Add(KeyCode.A, EmulatorBase.Button.Left);
        _keyMapping.Add(KeyCode.D, EmulatorBase.Button.Right);
        _keyMapping.Add(KeyCode.P, EmulatorBase.Button.A);
        _keyMapping.Add(KeyCode.O, EmulatorBase.Button.B);
        _keyMapping.Add(KeyCode.Return, EmulatorBase.Button.Start);
        _keyMapping.Add(KeyCode.Space, EmulatorBase.Button.Select);

        // Load emulator
        IVideoOutput drawable   = new DefaultVideoOutput();
        IAudioOutput audio      = GetComponent <DefaultAudioOutput>();
        ISaveMemory  saveMemory = new DefaultSaveMemory();

        Emulator = new Emulator(drawable, audio, saveMemory);
        ScreenRenderer.material.mainTexture = ((DefaultVideoOutput)Emulator.Video).Texture;

        gameObject.audio.enabled = false;
        StartCoroutine(LoadRom(Filename));

        // Disable some features to save on battery
        Input.gyro.enabled    = false;
        Input.compass.enabled = false;
    }
Example #3
0
    private void Awake()
    {
        // Init
        IVideoOutput drawable    = new DefaultVideoOutput();
        IAudioOutput audioOutput = audio;
        ISaveMemory  saveMemory  = new DefaultSaveMemory();

        Emulator = new Emulator(drawable, audioOutput, saveMemory);
        screenRenderer.material.mainTexture        = ((DefaultVideoOutput)Emulator.Video).Texture;
        audio.GetComponent <AudioSource>().enabled = false;
    }
Example #4
0
 // create an emulator and initialize it.
 void createEmulator(EmulatorBase emu)
 {
     m_emulator = emu;
     gfx.setEmuScreenSize(emu.getDisplayWidth(), emu.getDisplayHeight());
 }
    // Use this for initialization
    void Start()
    {
        chatDeControles = new ControladorDelChat(maximoDeLogsEnChat);
        chat.text       = "";

        // Load emulator
        IVideoOutput drawable   = new DefaultVideoOutput();
        IAudioOutput audio      = GetComponent <DefaultAudioOutput>();
        ISaveMemory  saveMemory = new DefaultSaveMemory();

        Emulator = new Emulator(drawable, audio, saveMemory);
        ScreenRenderer.material.mainTexture = ((DefaultVideoOutput)Emulator.Video).Texture;

        gameObject.GetComponent <AudioSource>().enabled = false;
        StartCoroutine(LoadRom(Filename));

        //twitch
        commands = new Dictionary <string, BotCommand>();
        commands.Add("!a", new BotCommand((a, b) => { //accion de comando
            Emulator.SetInput(EmulatorBase.Button.A, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.A));
            AgregandoComandoAlChat(b, "A");
        }));
        commands.Add("!b", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.B, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.B));
            AgregandoComandoAlChat(b, "B");
        }));
        commands.Add("!down", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.Down, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.Down));
            AgregandoComandoAlChat(b, "down");
        }));
        commands.Add("!left", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.Left, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.Left));
            AgregandoComandoAlChat(b, "left");
        }));
        commands.Add("!right", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.Right, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.Right));
            AgregandoComandoAlChat(b, "right");
        }));
        commands.Add("!select", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.Select, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.Select));
            AgregandoComandoAlChat(b, "select");
        }));
        commands.Add("!start", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.Start, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.Start));
            AgregandoComandoAlChat(b, "start");
        }));
        commands.Add("!up", new BotCommand((a, b) => { //aqui accion de comando
            Emulator.SetInput(EmulatorBase.Button.Up, true);
            this.StartCoroutineAsync(EnElProximoFrameQuitarlo(EmulatorBase.Button.Up));
            AgregandoComandoAlChat(b, "up");
        }));


        whenNewMessage       += (username, message) => Debug.Log($"{username}: {message}");
        whenNewSystemMessage += (message) => Debug.Log($"System: {message}");
        whenDisconnect       += () => Debug.Log("Desconexion");
        whenStart            += () => Debug.Log("Conexion");
        whenNewChater        += (username) => SendMessageToChat($"{username}, bienvenido al stream!");

        this.StartCoroutineAsync(StartConnection(maxRetry));
    }