Example #1
0
    /// <summary>
    /// gets called whenever Unity client gets message from React-Native
    /// Switch case populated with possible messages from React-Native front-end.
    /// </summary>
    private void OnMessage(MessageHandler message)
    {
        var data = message.getData <string>();
        var name = message.name;

        switch (name)
        {
        case "Layer 1":
            scriptAutoPlaceItem.ViewLayer1();
            break;

        case "Layer 2":
            scriptAutoPlaceItem.ViewLayer2();
            break;

        case "All Layers":
            scriptAutoPlaceItem.ViewAllLayers();
            break;

        case "Return to part":
            scriptClickManager.ReturnToPart();
            break;

        case "Return to machine":
            scriptClickManager.ReturnToMachine();
            break;

        case "Explode":
            scriptExplode.ExplodeObjToggle();
            break;

        case "Herstel van onderdeel X":
            scriptClickManager.chosenObject  = 0;
            scriptAutoPlaceItem.chosenObject = 0;
            break;

        case "Algemene controle":
            scriptClickManager.chosenObject  = 1;
            scriptAutoPlaceItem.chosenObject = 1;
            break;

        case "Kwaliteitscontrole":
            scriptClickManager.chosenObject  = 2;
            scriptAutoPlaceItem.chosenObject = 2;
            break;

        case "Reset":
            scriptResetScript.ResetScene();
            break;

        case "Info":
            callbackMsg = scriptClickManager.ReturnInfoToRN();
            break;

        default:
            break;
        }

        guiDebugText = name;


        Debug.Log("onMessage:" + data);
        message.send(new { CallbackTest = callbackMsg });
    }