Esempio n. 1
0
 void Init()
 {
     Config = gameObject.GetComponent <ViewComponentConfig>();
     if (Config != null)
     {
         //Debug.Log("found view config: " + _config);
     }
     else
     {
         Debug.LogWarning("Button with id: " + Id + " did not find a IDE config for this component, this is bad mojo. Throw some bad Error or smth.");
     }
 }
        public override void Execute(INotification notification)
        {
            ApplicationStateProxy stateProxy = Facade.RetrieveProxy(ApplicationStateProxy.NAME) as ApplicationStateProxy;
            Mediator mediator;

            switch (notification.Name)
            {
            case Notifications.SEND_UI_ACTION:
                ViewComponentConfig config = (notification.Body as ViewComponentConfig);
                switch (config.actions)
                {
                /*
                 * This space reserved for additional checks on actions. For example showing the user a modal first if confirmation is needed.
                 */
                case UIActions.TAKE_PHOTO:
                    mediator = Facade.RetrieveMediator(PhoneCamMediator.NAME) as PhoneCamMediator;
                    (mediator as PhoneCamMediator).TakePicture();
                    break;

                case UIActions.LOAD_PHOTO:
                    mediator = Facade.RetrieveMediator(PhoneCamMediator.NAME) as PhoneCamMediator;
                    (mediator as PhoneCamMediator).LoadPicture();
                    break;

                case UIActions.UPLOAD_PHOTO:
                    SendNotification(Notifications.REQUEST_RETRIEVE_DATA);
                    break;

                case UIActions.RESET_PHOTO:
                    stateProxy.SetState(ApplicationStates.USING_CAMERA);
                    Debug.Log("reset  photo action heard");
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
        }