Exemplo n.º 1
0
    public void OnPopChange()
    {
        TimerManager.Instance.AddTimer(100, (seq) => {
            if (Data.noder != null)
            {
                m_lblOK.text = m_poplist.GetSelect();
                pickType     = (PickType)m_poplist.GetIndex();

                Debug.Log("pickType: " + pickType);

                Dialog.Instance.Show(10085, () =>
                {
                    NetCommand.Instance.StateOder(Data.noder.id.ToString(), (int)pickType, (str) =>
                    {
                        if (pickType == PickType.CANCEL)
                        {
                            Toast.Instance.Show(10086);
                        }
                        else
                        {
                            Toast.Instance.Show(10087);
                        }
                        GameBaseInfo.Instance.UpdateOrders((success) =>
                                                           NGUITools.FindInParents <OrderPage>(gameObject).RefreshList());
                    });
                }, () =>
                {
                    m_lblOK.text = m_poplist.items [0];
                    pickType     = PickType.SELF;
                });
            }
        });
    }
        public long Add(PickType obj)
        {
            if (IsDuplicate(obj.Code, obj.Id, obj.CustomerId) == false)
            {
                return(_pickTypeRepository.Add(obj));
            }
            else
            {
                Expression <Func <PickType, bool> > res = x => x.Code == obj.Code && x.CustomerId == obj.CustomerId && x.IsActive == false;
                var model = _pickTypeRepository.Get(res);

                if (model != null)
                {
                    obj.Id       = model.Id;
                    obj.IsActive = true;

                    _pickTypeRepository.Detach(model);

                    _pickTypeRepository.Update(obj);
                    return(obj.Id);
                }
                else
                {
                    return(0);
                }
            }
        }
        protected void RotateLayer(Cube cube, RotationSense rotationSense, PickType pickType, int index)
        {
            FacePosition currentFacePosition = FacePosition.Front;
            FacePosition nextFacePosition    = currentFacePosition.Rotate(rotationSense, pickType);

            Face curFaceF = cube.GetFaceByPosition(currentFacePosition);
            Face curFaceU = cube.GetFaceByPosition(nextFacePosition);

            List <Color> oldColors = curFaceU.GetPiecesColorRange(pickType, index);
            List <Color> newColors = curFaceF.GetPiecesColorRange(pickType, index);

            FacePosition endPosition = GetEndingRotation(rotationSense, pickType);

            do
            {
                curFaceU.ChangeColorRange(pickType, index, newColors);

                newColors.Clear();
                newColors.AddRange(oldColors);

                currentFacePosition = nextFacePosition;
                nextFacePosition    = nextFacePosition.Rotate(rotationSense, pickType);

                curFaceF = cube.GetFaceByPosition(currentFacePosition);
                curFaceU = cube.GetFaceByPosition(nextFacePosition);

                oldColors.Clear();
                oldColors.AddRange(curFaceU.GetPiecesColorRange(pickType, index));
            } while (nextFacePosition != endPosition);
        }
Exemplo n.º 4
0
    override public bool Init(ObjectInitParam param)
    {
        PickInitParam pickParam = (PickInitParam)param;

        if (!DataManager.PickTable.ContainsKey(pickParam.pick_res_id))
        {
            GameDebug.LogError("pick表中不存在ID: " + pickParam.pick_res_id);
            return(false);
        }

        mRes        = DataManager.PickTable[pickParam.pick_res_id] as PickTableItem;
        mModelResID = mRes.modelId;
        mContent    = pickParam.content;
        mPickType   = pickParam.pick_type;
        mFlyType    = pickParam.fly_type;
        mRandomPos  = pickParam.random_pos;

        if (!base.Init(param))
        {
            return(false);
        }

        InitProperty();

        return(true);
    }
        protected FacePosition GetAdjacentFace(PickType pickType, int index)
        {
            switch (pickType)
            {
            case PickType.Horizontal:
                if (index == 1)
                {
                    return(FacePosition.Up);
                }
                if (index == 3)
                {
                    return(FacePosition.Down);
                }
                break;

            case PickType.Vertical:
                if (index == 1)
                {
                    return(FacePosition.Left);
                }
                if (index == 3)
                {
                    return(FacePosition.Right);
                }
                break;
            }

            throw new Exception("Face adjacente inexistante");
        }
Exemplo n.º 6
0
        public IHttpActionResult Post(PickType obj)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                long retId = _pickTypeService.Add(obj);

                if (retId == 0)
                {
                    Log.Info($"{typeof(PickTypeController).FullName}||{UserEnvironment}||Add record not successful, Pick Type Code is duplicate.");
                    return(Content(HttpStatusCode.Forbidden, "Pick Type Code is Duplicate"));
                }
                var    response = this.Request.CreateResponse(HttpStatusCode.Created);
                string test     = JsonConvert.SerializeObject(new
                {
                    id      = retId,
                    message = "Pick Type added"
                });
                response.Content = new StringContent(test, Encoding.UTF8, "appliation/json");
                Log.Info($"{typeof(PickType).FullName}||{UserEnvironment}||Add record successful.");

                return(ResponseMessage(response));
            }
            catch (Exception e)
            {
                Log.Error(typeof(PickTypeController).FullName, e);

                return(Content(HttpStatusCode.NotAcceptable, e.Message));
            }
        }
Exemplo n.º 7
0
        public List <Piece> GetPiecesRange(PickType pickType, int index)
        {
            if (index > Size)
            {
                throw new Exception("L'index spécifié est supérieur à la taille du cube");
            }

            List <Piece> pieces = new List <Piece>();

            switch (pickType)
            {
            case PickType.Vertical:

                for (int i = 0; i < Size; i++)
                {
                    pieces.Add(Pieces[index - 1, i]);
                }
                break;

            case PickType.Horizontal:

                for (int i = 0; i < Size; i++)
                {
                    pieces.Add(Pieces[i, index - 1]);
                }
                break;
            }

            return(pieces);
        }
        public bool Update(PickType obj)
        {
            //var getObj = GetById(obj.Id);
            //_db.Entry(getObj).State = System.Data.Entity.EntityState.Detached;
            _db.Entry(obj).State = EntityState.Modified;
            //_db.PickTypes.Attach(obj);
            _db.SaveChanges();

            return(true);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 选取指定的线
 /// </summary>
 /// <returns></returns>
 public void Pick(PickType type, IPickFilter filter)
 {
     this.SetPickFilter(filter);
     this.isPick   = true;
     this.pickType = type;
     Cursor        = CursorGetter.Getter(CursorStyle.Pick);
     //首先删除界面上所有的选择对象
     this.RemoveTemporaryVisualsByType(1);
     this.SelectIntersectGeometrys = new List <IntersectGeometry>();
 }
 public bool Update(PickType obj)
 {
     if (IsDuplicate(obj.Code, obj.Id, obj.CustomerId) == false)
     {
         return(_pickTypeRepository.Update(obj));
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 11
0
        protected void RotateAdjacentSide(Cube cube, RotationSense rotationSense, PickType pickType, int index)
        {
            if (index == 2)
            {
                return;
            }

            Face adjacentFace = cube.GetFaceByPosition(GetAdjacentFace(pickType, index));

            RotateMiddlePieces(adjacentFace, rotationSense);
            RotateCornerPieces(adjacentFace, rotationSense);
        }
 public long Add(PickType obj)
 {
     try
     {
         _db.PickTypes.Add(obj);
         _db.SaveChanges();
         return(obj.Id);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemplo n.º 13
0
        protected FacePosition GetEndingRotation(RotationSense rotationSense, PickType pickType)
        {
            switch (pickType)
            {
            case PickType.Horizontal:
                return(rotationSense == RotationSense.Clockwise ? FacePosition.Left : FacePosition.Right);

            case PickType.Vertical:
                return(rotationSense == RotationSense.Clockwise ? FacePosition.Up : FacePosition.Down);
            }

            return(default(FacePosition));
        }
Exemplo n.º 14
0
        public void ChangeColorRange(PickType pickType, int index, List <Color> colors)
        {
            List <Piece> pieces = GetPiecesRange(pickType, index);

            if (pieces.Count != colors.Count)
            {
                throw new Exception("La taille de la liste des couleurs diffère de celle du cube");
            }

            for (int i = 0; i < Size; i++)
            {
                pieces[i].Color = colors[i];
            }
        }
        public static FacePosition RotateAnticlockwise(this FacePosition face, PickType pickType)
        {
            if (pickType == PickType.Vertical)
            {
                switch (face)
                {
                case FacePosition.Front:
                    return(FacePosition.Down);

                case FacePosition.Up:
                    return(FacePosition.Front);

                case FacePosition.Down:
                    return(FacePosition.Back);

                case FacePosition.Back:
                    return(FacePosition.Up);

                case FacePosition.Right:
                case FacePosition.Left:
                default:
                    return(face);
                }
            }
            else if (pickType == PickType.Horizontal)
            {
                switch (face)
                {
                case FacePosition.Left:
                    return(FacePosition.Front);

                case FacePosition.Front:
                    return(FacePosition.Right);

                case FacePosition.Right:
                    return(FacePosition.Back);

                case FacePosition.Back:
                    return(FacePosition.Left);

                case FacePosition.Up:
                case FacePosition.Down:
                default:
                    return(face);
                }
            }

            return(face);
        }
Exemplo n.º 16
0
        // PUT api/<controller>/5
        public IHttpActionResult Put(PickType obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bool IsNotDuplicate = _pickTypeService.Update(obj);

            if (IsNotDuplicate == true)
            {
                Log.Info($"{typeof(PickTypeController).FullName}||{UserEnvironment}||Update record successful.");
                return(Content(HttpStatusCode.OK, "Pick Type record was updated successfully."));
            }
            Log.Info($"{typeof(PickTypeController).FullName}||{UserEnvironment}||Update record not successful, Pick Type Code is duplicate.");
            return(Content(HttpStatusCode.Forbidden, "Pick Type Code is Duplicate"));
        }
Exemplo n.º 17
0
 /// <summary>
 /// Creates one or more tournament codes. This method uses the Tournament API. This endpoint is only accessible if you have a tournament API key.
 /// IMPORTANT: if you are using an interim API key, you must set <see cref="RiotClientSettings.UseTournamentStub"/> to true before calling this method.
 /// </summary>
 /// <param name="tournamentId">The tournament ID obtained from <see cref="CreateTournamentAsync"/>.</param>
 /// <param name="count">The number of codes to create (max 1000).</param>
 /// <param name="allowedSummonerIds">Optional list of participants in order to validate the players eligible to join the lobby.</param>
 /// <param name="mapType">The map type of the game. Note that <see cref="MapType.CRYSTAL_SCAR"/> is not allowed.</param>
 /// <param name="pickType">The pick type of the game.</param>
 /// <param name="spectatorType">The spectator type of the game.</param>
 /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
 /// <param name="metadata">Optional string that may contain any data in any format, if specified at all. Used to denote any custom information about the game.</param>
 /// <returns>A task representing the asynchronous operation.</returns>
 public Task<List<string>> CreateTournamentCodeAsync(long tournamentId, int? count = null, List<long> allowedSummonerIds = null, MapType mapType = MapType.SUMMONERS_RIFT,
     PickType pickType = PickType.TOURNAMENT_DRAFT, SpectatorType spectatorType = SpectatorType.ALL, int teamSize = 5, string metadata = null)
 {
     var publicOrStub = settings.UseTournamentStub ? "stub" : "public";
     var queryParameters = new Dictionary<string, object> { { "tournamentId", tournamentId } };
     if (count != null)
         queryParameters["count"] = count;
     return PostAsync<List<string>>($"{globalBaseUrl}/tournament/{publicOrStub}/{TournamentApiVersion}/code", new
     {
         allowedSummonerIds = allowedSummonerIds != null ? new { participants = allowedSummonerIds } : null,
         mapType,
         pickType,
         spectatorType,
         teamSize,
         metadata
     }, queryParameters);
 }
        public MazePoint RandomPoint(MazeSize size, PickType type)
        {
            var x = _randomValueGenerator.GetNext(0, size.X - 1);
            var y = _randomValueGenerator.GetNext(0, size.Y - 1);
            var z = _randomValueGenerator.GetNext(0, size.Z - 1);

            if (type == PickType.RandomEdge)
            {
                switch ((RandomEdgeOptions)_randomValueGenerator.GetNext(1, 6))
                {
                case RandomEdgeOptions.MinX:
                    x = 0;
                    break;

                case RandomEdgeOptions.MaxX:
                    x = size.X - 1;
                    break;

                case RandomEdgeOptions.MinY:
                    y = 0;
                    break;

                case RandomEdgeOptions.MaxY:
                    y = size.Y - 1;
                    break;

                case RandomEdgeOptions.MinZ:
                    z = 0;
                    break;

                case RandomEdgeOptions.MaxZ:
                    z = size.Z - 1;
                    break;
                }
            }
            return(_mazePointFactory.MakePoint(x, y, z));
        }
Exemplo n.º 19
0
		public override void EndPick(SlimDX.Vector2 mousePos, PickType pickType, UiControl control)
		{
			base.EndPick(mousePos, pickType, control);
		}
        public static FacePosition Rotate(this FacePosition face, RotationSense rotationSense, PickType pickType)
        {
            switch (rotationSense)
            {
            case RotationSense.Clockwise:
                return(RotateClockwise(face, pickType));

            case RotationSense.Counterclockwise:
                return(RotateAnticlockwise(face, pickType));

            default:
                return(face);
            }
        }
Exemplo n.º 21
0
 public override string ToString()
 {
     return(string.Format("get [{0}] from [{1}] by [{2} grep]({3}) with [{4}]", ParameterName, PickRange.ToString(), PickType.ToString(), PickTypeAdditional, PickTypeExpression));
 }
Exemplo n.º 22
0
 public void Rotate(Cube cube, RotationSense rotationSense, PickType pickType, int index)
 {
     RotateLayer(cube, rotationSense, pickType, index);
     RotateAdjacentSide(cube, rotationSense, pickType, index);
 }
Exemplo n.º 23
0
		public override void EndPick(SlimDX.Vector2 mousePos, PickType pickType, UiControl control)
		{
			base.EndPick(mousePos, pickType, control);
			 
			UiControl par = Parent;

			switch (pickType)
			{			
				case PickType.Focus:
					/* if (DoClick() == false)
					{
						Open();
					}
					else
					{
						Close();
					}*/ 
					break;				
				case PickType.UnFocus:
					if (control == null || control.IsDescendantOf(this) == false)
					{ 
						Close();
					}
					break;
				default:
					break;
			}			
		}
Exemplo n.º 24
0
		public override void EndPick(Vector2 mousePos, PickType pickType, UiControl control) { }
Exemplo n.º 25
0
 public MousePicking()
 {
     PickOnly = PickType.PickNothing;
 }
Exemplo n.º 26
0
 public MouseOverList(Point mousePosition, PickType pickType)
 {
     m_overList    = new List <MouseOverItem>();
     MousePosition = mousePosition;
     PickType      = pickType;
 }
Exemplo n.º 27
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ID != 0L)
            {
                hash ^= ID.GetHashCode();
            }
            if (CommandType != 0)
            {
                hash ^= CommandType.GetHashCode();
            }
            if (MoveDirection != 0)
            {
                hash ^= MoveDirection.GetHashCode();
            }
            if (MoveDuration != 0)
            {
                hash ^= MoveDuration.GetHashCode();
            }
            if (ThrowDistance != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ThrowDistance);
            }
            if (ThrowAngle != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ThrowAngle);
            }
            if (IsThrowDish != false)
            {
                hash ^= IsThrowDish.GetHashCode();
            }
            if (UseType != 0)
            {
                hash ^= UseType.GetHashCode();
            }
            if (SpeakText.Length != 0)
            {
                hash ^= SpeakText.GetHashCode();
            }
            if (Parameter1 != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Parameter1);
            }
            if (Parameter2 != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Parameter2);
            }
            if (IsSetTalent != false)
            {
                hash ^= IsSetTalent.GetHashCode();
            }
            if (IsPickSelfPosition != false)
            {
                hash ^= IsPickSelfPosition.GetHashCode();
            }
            if (PickType != 0)
            {
                hash ^= PickType.GetHashCode();
            }
            if (PickDishOrToolType != 0)
            {
                hash ^= PickDishOrToolType.GetHashCode();
            }
            if (Talent != 0)
            {
                hash ^= Talent.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 public void Detach(PickType obj)
 {
     _db.Entry(obj).State = EntityState.Detached;
 }
Exemplo n.º 29
0
 public void OnPopChange()
 {
     m_type.text = m_poplist.GetSelect();
     pickType    = (PickType)m_poplist.GetIndex();
 }
Exemplo n.º 30
0
 /// <summary>
 /// Saves changes to a tournament code. This method uses the Tournament API. This endpoint is only accessible if you have a tournament API key.
 /// IMPORTANT: if you are using an interim API key, you must set <see cref="RiotClientSettings.UseTournamentStub"/> to true before calling this method.
 /// </summary>
 /// <param name="tournamentCode">The tournament code obtained from <see cref="CreateTournamentCodeAsync"/>.</param>
 /// <param name="allowedSummonerIds">Optional list of participants in order to validate the players eligible to join the lobby.</param>
 /// <param name="mapType">The map type of the game.</param>
 /// <param name="pickType">The pick type of the game.</param>
 /// <param name="spectatorType">The spectator type of the game.</param>
 public Task UpdateTournamentCodeAsync(string tournamentCode, List<long> allowedSummonerIds = null, MapType mapType = MapType.SUMMONERS_RIFT,
     PickType pickType = PickType.TOURNAMENT_DRAFT, SpectatorType spectatorType = SpectatorType.ALL)
 {
     var publicOrStub = settings.UseTournamentStub ? "stub" : "public";
     return PutAsync<object>($"{globalBaseUrl}/tournament/{publicOrStub}/{TournamentApiVersion}/code/{tournamentCode}", new
     {
         allowedParticipants = allowedSummonerIds != null ? string.Join(",", allowedSummonerIds) : null,
         mapType,
         pickType,
         spectatorType
     });
 }
Exemplo n.º 31
0
 public MouseOverList(MousePicking mousePicking)
 {
     _items        = new List <MouseOverItem>();
     MousePosition = mousePicking.Position;
     PickType      = mousePicking.PickOnly;
 }
Exemplo n.º 32
0
 public List <Color> GetPiecesColorRange(PickType pickType, int index)
 {
     return(GetPiecesRange(pickType, index).Select(p => p.Color).ToList());
 }