Exemplo n.º 1
0
 public void AddAction(AppMirrorAction action)
 {
     this.actionQueue.Add(action);
 }
Exemplo n.º 2
0
 private void RequestServiceCommand(AppMirrorAction.AppActionTypes actionType, Oniyamma.LogType? logType, AppMirrorAction action)
 {
     switch (actionType)
     {
         case AppMirrorAction.AppActionTypes.GreetingLogging:
             {
                 this.StartCoroutine(this.TakePhoto(
                    delegate (string fileName)
                    {
                        Debug.Log(string.Format("Command:{0}  ScreenShot:{1} {2}", logType, fileName, File.Exists(fileName)));
                        this.Service.AddLog(new LogParameter()
                        {
                            Type = logType,
                            FilePath = fileName,
                            UserId = action.UserName,
                        });
                    })
                    );
                 this.AddAction(new AppMirrorAction(MirrorAction<AppMirrorAction.AppActionTypes>.ActionTypes.SystemFeedback, serviceUiFeedbackMap[(Oniyamma.LogType)logType]));
             }
             break;
         case AppMirrorAction.AppActionTypes.EmotionLoging:
             {
                 Debug.Log(string.Format("Command:{0}  SMILE:{1}", "Emotion", action.FaceExpressions.Smile));
                 this.Service.ApplyEmotion(new EmotionParameter()
                 {
                     Kiss = action.FaceExpressions.Kiss,
                     Smile = action.FaceExpressions.Smile,
                     MouthOpen = action.FaceExpressions.MouthOpen,
                     EyesUp = action.FaceExpressions.EyesUp,
                     EyesDown = action.FaceExpressions.EyesDown,
                     EyesClosedLeft = action.FaceExpressions.EyesClosedLeft,
                     EyesClosedRight = action.FaceExpressions.EyesClosedRight,
                 });
             }
             break;
         case AppMirrorAction.AppActionTypes.WeatherQuery:
             {
                 var weathers = new WeatherType[4]
                 {
                     WeatherType.SUNNY,
                     WeatherType.CLOUDY,
                     WeatherType.RAINY,
                     WeatherType.SNOW,
                 };
                 var weather = this.Service.GetWeather(weathers[UnityEngine.Random.Range(0, 4)]);
                 Debug.Log(weather.Type);
                 this.currentWeather = weather.Type;
             }
             this.AddAction(new AppMirrorAction(MirrorAction<AppMirrorAction.AppActionTypes>.ActionTypes.SystemFeedback, AppMirrorAction.AppActionTypes.WeatherQueryFeedback));
             break;
     }
 }
Exemplo n.º 3
0
 private void ProcessSystemFeedback(AppMirrorAction action)
 {
     Debug.Log(action.HasAppData);
     if (action.HasAppData)
     {
         var actionType = action.AppData;
         switch (actionType)
         {
             case AppMirrorAction.AppActionTypes.FaceTrackedFeedback:
                 {
                     this.StartCoroutine(this.OnFaceActivted());
                 }
                 break;
             case AppMirrorAction.AppActionTypes.FaceLostFeedback:
                 {
                     this.StartCoroutine(this.OnFaceLost());
                 }
                 break;
             case AppMirrorAction.AppActionTypes.LeaveHomeFeedback:
                 {
                     var ui = this.commandUIMap[actionType];
                     ui.GetComponent<Animator>().Play("Fire", 0, 0.0f);
                     this.StartCoroutine(this.OnLeaveHomeFeedback());
                 }
                 break;
             case AppMirrorAction.AppActionTypes.GoHomeFeedback:
                 {
                     var ui = this.commandUIMap[actionType];
                     ui.GetComponent<Animator>().Play("Fire", 0, 0.0f);
                     this.StartCoroutine(this.OnGoHomeFeedback());
                 }
                 break;
             case AppMirrorAction.AppActionTypes.WeatherQueryFeedback:
                 {
                     var ui = this.commandUIMap[actionType];
                     ui.GetComponent<Animator>().Play("Fire", 0, 0.0f);
                     this.StartCoroutine(this.OnWeatherFeedback());
                 }
                 break;
         }
     }
 }
Exemplo n.º 4
0
 private void ProcessHumanInput(AppMirrorAction action)
 {
     if (action.FaceExpressions != null)
     {
         this.RequestServiceCommand(AppMirrorAction.AppActionTypes.EmotionLoging, null, action);
         this.echoExpressionText.text = string.Format("SMILE:{0} KISS:{1}", action.FaceExpressions.Smile, action.FaceExpressions.Kiss);
     }
     else
     {
         if (action.Sentence != string.Empty)
         {
             this.echoSentenseText.text = action.Sentence;
             foreach (var key in sentenceCommandMap.Keys)
             {
                 if (action.Sentence.IndexOf(key) > -1)
                 {
                     if (sentenceCommandMap[key] is Oniyamma.LogType)
                     {
                         this.RequestServiceCommand(AppMirrorAction.AppActionTypes.GreetingLogging, (Oniyamma.LogType)sentenceCommandMap[key], action);
                     }
                     if (sentenceCommandMap[key] is AppMirrorAction.AppActionTypes)
                     {
                         this.RequestServiceCommand((AppMirrorAction.AppActionTypes)sentenceCommandMap[key], null, action);
                     }
                 }
             }
         }
         if (action.HandGesture != AppMirrorAction.HandGestures.None)
         {
             this.echoGestureText.text = AppMirrorAction.handGestureNames[action.HandGesture];
             foreach (var key in gestureCommandMap.Keys)
             {
                 if (action.HandGesture == key)
                 {
                     if (gestureCommandMap[key] is Oniyamma.LogType)
                     {
                         this.RequestServiceCommand(AppMirrorAction.AppActionTypes.GreetingLogging, (Oniyamma.LogType)gestureCommandMap[key], action);
                     }
                     if (gestureCommandMap[key] is AppMirrorAction.AppActionTypes)
                     {
                         this.RequestServiceCommand((AppMirrorAction.AppActionTypes)gestureCommandMap[key], null, action);
                     }
                 }
             }
         }
     }
 }