Beispiel #1
0
        public static String GetActionUrl(ActionKey action)
        {
            var actionUrl = "";

            switch (action)
            {
                case ActionKey.ListRooms:
                    actionUrl = "rooms/list";
                    break;

                case ActionKey.ShowRoom:
                    actionUrl = "rooms/show";
                    break;

                case ActionKey.CreateRoom:
                    actionUrl = "rooms/create";
                    break;

                case ActionKey.DeleteRoom:
                    actionUrl = "rooms/delete";
                    break;

                case ActionKey.MessageRoom:
                    actionUrl = "rooms/message";
                    break;

                case ActionKey.GetRoomHistory:
                    actionUrl = "rooms/history";
                    break;

                case ActionKey.ListUsers:
                    actionUrl = "users/list";
                    break;

                case ActionKey.ShowUser:
                    actionUrl = "users/show";
                    break;

                case ActionKey.CreateUser:
                    actionUrl = "users/create";
                    break;

                case ActionKey.DeleteUser:
                    actionUrl = "users/delete";
                    break;

                case ActionKey.UpdateUser:
                    actionUrl = "users/update";
                    break;

                case ActionKey.SetTopic:
                    actionUrl = "rooms/topic";
                    break;

                //TODO: Create a custom HipChapException Type
                default:
                    throw new NotImplementedException(String.Format("NotImplementedException: {0}", action.ToString()));
            }
            return actionUrl;
        }
        public bool IsKeyPressed(ActionKey key, KeyboardState oldState)
        {
            bool down = IsKeyDown(key);
            bool wasDown = IsKeyDown(key, oldState);

            return down && !wasDown;
        }
Beispiel #3
0
        public static String GetActionMethod(ActionKey action)
        {
            string actionMethod = "";

            switch (action)
            {
                case ActionKey.ListRooms:
                case ActionKey.ListUsers:
                case ActionKey.ShowRoom:
                case ActionKey.ShowUser:
                case ActionKey.GetRoomHistory:
                    actionMethod = "GET";
                    break;

                case ActionKey.DeleteUser:
                case ActionKey.CreateUser:
                case ActionKey.MessageRoom:
                case ActionKey.SetTopic:
                    actionMethod = "POST";
                    break;

                default:
                    throw new NotImplementedException(String.Format("NotImplmentedException: {0}", action.ToString()));
            }
            return actionMethod;
        }
 public HipChatContext(String baseApiUrl, String apiKey, ActionKey action, IDictionary<string,string> parms, HipChatResponseFormat responseFormat = HipChatResponseFormat.Json )
 {
     _apiKey = apiKey;
     Action = action;
     BaseUrl = baseApiUrl;
     _responseFormat = responseFormat;
     _actionParms = (parms != null ? parms : new Dictionary<string, string>());
 }
        private void SetNames(ActionKey actionKey)
        {
            ClaimEventData claimEventData = actionKey.NodeInfo.DataObject.Data as ClaimEventData;

            if (claimEventData.CreatedByUserID != null)
            {
                this.claimModel.CreatedByUserName = claimEventData.CreatedByUserName;
            }

            if (claimEventData.TaskInitialUserID != null)
            {
                IMetadataClientService metaDataService = ApplicationModel.Instance.Container.Resolve<IMetadataClientService>();
                metaDataService.QueryNameDetails(claimEventData.TaskInitialUserID.Value, (task) =>
                {
                    this.claimModel.TaskInitialUserName = task.UserDescription;
                }, null);
            }
        }
Beispiel #6
0
        // Actions
        public static bool ActionKeyReleased(ActionKey action, PlayerIndex index)
        {
            var binding = _bindings[action];

            // Check buttons
            if (binding.Buttons.Any(button => ButtonReleased(button, index)))
                return true;

            // Check keys
            if (binding.Keys.Any(key => KeyReleased(key)))
                return true;

            if (binding.ThumbStickDirectionMapped && binding.ThumbStickDirection == ThumbStickLeft)
                return true;

            return false;
        }
    private void PressComponentButton( int _ComponentIndex , ActionKey _Action )
    {
        int keyIndex = (int) _Action ;
        UnityEngine.UI.Image [] _Images = null ;
        switch( _ComponentIndex )
        {
        case 0 :
            _Images = m_Component0ButtonsImages ;
            break ;
        case 1 :
            _Images = m_Component1ButtonsImages ;
            break ;
        case 2 :
            _Images = m_Component2ButtonsImages ;
            break ;
        }

        SetColorForSelectComponentButtons( _Images , keyIndex ) ;

        SetAction( _ComponentIndex , _Action ) ;

        HideAllEnergyBackground() ;
    }
 public HipChatConnection Create(ActionKey action)
 {
     return Create(action, null);
 }
 public bool IsKeyDown(ActionKey key)
 {
     bool down = IsKeyDown(key, keyboardState);
     return down;
 }
Beispiel #10
0
 public string GetString(ActionKey _Key)
 {
     TryInitialize();
     return(_Key.ToString());
 }
        void GenerateArgumentPermutations(StateData stateData, NativeList <ActionKey> argumentPermutations)
        {
            var MoverFilter = new NativeArray <ComponentType>(3, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Generated.AI.Planner.StateRepresentation.Moveable>(), [1] = ComponentType.ReadWrite <Unity.AI.Planner.DomainLanguage.TraitBased.Location>(), [2] = ComponentType.ReadWrite <Generated.AI.Planner.StateRepresentation.Robot>(),
            };
            var DestinationFilter = new NativeArray <ComponentType>(2, Allocator.Temp)
            {
                [0] = ComponentType.ReadWrite <Unity.AI.Planner.DomainLanguage.TraitBased.Location>(), [1] = ComponentType.Exclude <Generated.AI.Planner.StateRepresentation.Moveable>(),
            };
            var MoverObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(MoverObjectIndices, MoverFilter);

            var DestinationObjectIndices = new NativeList <int>(2, Allocator.Temp);

            stateData.GetTraitBasedObjectIndices(DestinationObjectIndices, DestinationFilter);

            var LocationBuffer = stateData.LocationBuffer;
            var RobotBuffer    = stateData.RobotBuffer;



            for (int i0 = 0; i0 < MoverObjectIndices.Length; i0++)
            {
                var MoverIndex  = MoverObjectIndices[i0];
                var MoverObject = stateData.TraitBasedObjects[MoverIndex];


                if (!(RobotBuffer[MoverObject.RobotIndex].Battery > 0))
                {
                    continue;
                }



                for (int i1 = 0; i1 < DestinationObjectIndices.Length; i1++)
                {
                    var DestinationIndex  = DestinationObjectIndices[i1];
                    var DestinationObject = stateData.TraitBasedObjects[DestinationIndex];

                    if (!(LocationBuffer[MoverObject.LocationIndex].Position != LocationBuffer[DestinationObject.LocationIndex].Position))
                    {
                        continue;
                    }



                    var actionKey = new ActionKey(k_MaxArguments)
                    {
                        ActionGuid           = ActionGuid,
                        [k_MoverIndex]       = MoverIndex,
                        [k_DestinationIndex] = DestinationIndex,
                    };
                    argumentPermutations.Add(actionKey);
                }
            }
            MoverObjectIndices.Dispose();
            DestinationObjectIndices.Dispose();
            MoverFilter.Dispose();
            DestinationFilter.Dispose();
        }
Beispiel #12
0
 void StartMorphingModel(Character _CharRef, int _ChunkIndex, ActionKey _Action)
 {
     switch (_Action)
     {
     // so far, we only morph defense, the other action will stay in not morphing status.
     case ActionKey.Defend:
         _CharRef.StartMorphingModel(_ChunkIndex, MODELTYPE.E_DEFENSE);
         break;
     }
 }
Beispiel #13
0
 void OnInitAction(Character _CharRef, int _ChunkIndex, ActionKey _Action)
 {
     switch (_Action)
     {
         case ActionKey.Defend:
             _CharRef.DoChangeModel(_ChunkIndex, MODELTYPE.E_DEFENSE);
             // _CharRef.DoAction(_ChunkIndex, AnimationState.Defend, 2.0f);
             break;
     }
     _CharRef.ClearAllOpponentTargets() ;
 }
Beispiel #14
0
    void OnAction(Character _CharRef, Character _OtherRef, int _ChunkIndex, ActionKey _Action)
    {
        GlobalSingleton.DEBUG(_CharRef.name + "," + _ChunkIndex + "," + _Action);
        switch (_Action)
        {
            case ActionKey.Attack:
                _CharRef.DoChangeModel(_ChunkIndex, MODELTYPE.E_ATTACK);
                _CharRef.DoAction(_ChunkIndex, AnimationState.Attack, 1.2f);
                _CharRef.SetOpponentTarget( _ChunkIndex ) ;

                _OtherRef.DoAction(_ChunkIndex, AnimationState.Hitted, 1.2f);
                _OtherRef.SetOpponentTarget( _ChunkIndex ) ;
                break;

            case ActionKey.Defend:
                _CharRef.DoChangeModel(_ChunkIndex, MODELTYPE.E_DEFENSE);
                _OtherRef.ClearOpponentTarget( _ChunkIndex );
                // _CharRef.DoAction(_ChunkIndex, AnimationState.Defend, 2.0f);
                break;

            case ActionKey.Concentrate:
                _CharRef.DoChangeModel(_ChunkIndex, MODELTYPE.E_CONCENTRATE);
                _OtherRef.ClearOpponentTarget( _ChunkIndex );
                break;
        }
    }
Beispiel #15
0
 bool IsActionNeedsPlayAnimation( ActionKey _AttackAction , ActionKey _DefenseAction )
 {
     bool ret = false ;
     if( _AttackAction == ActionKey.Attack )
     {
         ret = true ;
     }
     return ret ;
 }
Beispiel #16
0
 public string GetString( ActionKey _Key )
 {
     TryInitialize() ;
     return _Key.ToString() ;
 }
 //TODO: Factory vs Builder
 public HipChatConnection Create(ActionKey action, IDictionary<string,string> actionParms)
 {
     var connection = new HipChatConnection(connectionSettings, CreateContext(action,actionParms));
     return connection;
 }
 private bool IsKeyDown(ActionKey key, KeyboardState state)
 {
     Keys combination = config[key];
     return state.IsKeyDown(combination);
 }
 private HipChatContext CreateContext(ActionKey action, IDictionary<string,string> actionParms )
 {
     return new HipChatContext(connectionSettings.BaseApiUrl, connectionSettings.AuthKey, action, actionParms);
 }
Beispiel #20
0
 public void GiveSecondaryGoal(ActionKey goal)
 {
     secondayGoalKey = goal;
 }
    public void SetAction( int _ComponentIndex , ActionKey _Action )
    {
        // Debug.Log("SetAction() _ComponentIndex=" + _ComponentIndex + " _Action=" + _Action );
        m_SelectedActions[ _ComponentIndex ] = _Action ;

        int currentCostEnergy = CalculateCostEnergyFromInput() ;
        SetEnergyGrid( m_Player.Energy , currentCostEnergy , 0 ) ;
    }
Beispiel #22
0
        /// <summary>
        /// Tests for key pressed once
        /// </summary>
        /// <param name="action">action used</param>
        /// <param name="index">index of player</param>
        /// <returns>boolean value</returns>
        public static bool ActionKeyPressed(ActionKey action, PlayerIndex index)
        {
            //Console.Clear();
            //Console.WriteLine(_gamePadStates[(int)index].ToString());
            //Console.WriteLine("A: " + _gamePadStates[(int)index].IsButtonDown(Buttons.A));
            //Console.WriteLine("B: " + _gamePadStates[(int)index].IsButtonDown(Buttons.B));
            //Console.WriteLine("LB: " + _gamePadStates[(int)index].IsButtonDown(Buttons.LeftShoulder));
            //Console.WriteLine("RB: " + _gamePadStates[(int)index].IsButtonDown(Buttons.RightShoulder));

            var binding = _bindings[action];

            // Check buttons
            if (binding.Buttons.Any(button => ButtonPressed(button, index)))
                return true;

            // Check keys
            if (binding.Keys.Any(key => KeyPressed(key)))
                return true;

            if (binding.ThumbStickDirectionMapped && binding.ThumbStickDirection == ThumbStickLeft)
                return true;

            return false;
        }