private void checkSlotPosition(float tiltValue) { SlotPosition currentSlot = playerController.getCurrentSlotPosition(); switch (currentSlot) { case SlotPosition.Center: if (tiltValue < -accelerometerRightSlotValue) { playerController.changeSlots(SlotPosition.Left); } else if (tiltValue > accelerometerRightSlotValue) { playerController.changeSlots(SlotPosition.Right); } break; case SlotPosition.Left: if (tiltValue > -accelerometerRightSlotValue + accelerometerSensitivity) { playerController.changeSlots(SlotPosition.Center); } break; case SlotPosition.Right: if (tiltValue < accelerometerRightSlotValue - accelerometerSensitivity) { playerController.changeSlots(SlotPosition.Center); } break; } }
//点击操作装备技能 public void SendMsg(int targetId, SlotPosition targetPos) { if (uiSkillInfo == null) { return; } //uiSkillInfo.SkillId为SourceId,==-1则返回 if (uiSkillInfo.SkillId == -1) { return; } int sourceId = uiSkillInfo.SkillId; UISkillSlot sourceSlot = uiSkillStorage.GetSlot(sourceId); int currentPreset = UISkillSetting.presetIndex; if (sourceSlot != null) { if (sourceSlot.EquipedPos != null && sourceSlot.EquipedPos.Presets[currentPreset] == SlotPosition.SP_None) { LogicSystem.PublishLogicEvent("ge_mount_skill", "lobby", currentPreset, sourceId, targetPos); } else { LogicSystem.PublishLogicEvent("ge_swap_skill", "lobby", currentPreset, sourceId, sourceSlot.EquipedPos.Presets[UISkillSetting.presetIndex], targetPos); } } }
//check to see if botpart is in slot position public bool IsBotPartInSlot(SlotPosition slotPosition) { //get slot using slot position GameObject slot = GetSlot(slotPosition); return(slot.GetComponent <BotPart>()); }
// There are three slots on a track. Move left or right if there is a slot available public void changeSlots(bool right) { currentSlotPosition = (SlotPosition)Mathf.Clamp((int)currentSlotPosition + (right ? 1 : -1), (int)SlotPosition.Left, (int)SlotPosition.Right); targetSlotValue = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; updateTargetPosition(thisTransform.eulerAngles.y); }
// There are three slots on a track. Move left or right if there is a slot available public void ChangeSlots(bool right) { SlotPosition targetSlot = (SlotPosition)Mathf.Clamp((int)currentSlotPosition + (right ? 1 : -1), (int)SlotPosition.Left, (int)SlotPosition.Right); ChangeSlots(targetSlot); }
//Get the slot gameobject by using the slotpositioon enum private GameObject GetSlot(SlotPosition slotPosition) { GameObject slot = default(GameObject); //match slotposition to correct slot switch (slotPosition) { case SlotPosition.Top: slot = top; break; case SlotPosition.Side: slot = side; break; case SlotPosition.Bottom: slot = bottom; break; case SlotPosition.Back: slot = back; break; default: break; } //return correct gamebject located at slot return(slot); }
public void SetCurSkillSlotPos(int preset, SlotPosition pos) { if (preset >= 0 && preset < PresetNum) { Presets[preset] = pos; } }
public void InitSkillBar(List <SkillInfo> skillInfos) { try { if (UIDataCache.Instance.IsMultPveScene()) { NGUITools.SetActive(spAshEx.gameObject, false); } if (m_TriggerSceneId != UIDataCache.Instance.curSceneId) { if (!IsSceneFinished(m_TriggerSceneId)) { NGUITools.SetActive(spAshEx.gameObject, false); } } for (int i = 0; i < m_CategoryArray.Length; ++i) { UnlockSkill(m_CategoryArray[i], false); } if (skillInfos != null && skillInfos.Count > 0) { SkillInfo[] skillInfoArray = skillInfos.ToArray(); for (int i = 0; i < skillInfoArray.Length; ++i) { if (skillInfoArray[i] != null) { SlotPosition skill_pos = skillInfoArray[i].Postions.Presets[0]; SkillCategory cur_skill_pos = SkillCategory.kNone; if (skill_pos == SlotPosition.SP_A) { cur_skill_pos = SkillCategory.kSkillA; } else if (skill_pos == SlotPosition.SP_B) { cur_skill_pos = SkillCategory.kSkillB; } else if (skill_pos == SlotPosition.SP_C) { cur_skill_pos = SkillCategory.kSkillC; } else if (skill_pos == SlotPosition.SP_D) { cur_skill_pos = SkillCategory.kSkillD; } if (SkillCategory.kNone != cur_skill_pos) { UnlockSkill(cur_skill_pos, true, skillInfoArray[i].ConfigData); } /// // Debug.Log("skillinit skill_id : {" + skillInfoArray[i].SkillId + "}, skill_level : {" + skillInfoArray[i].SkillLevel + "}, skill_slotpos : {" + skill_pos + "}"); } } } } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
// Reset values public void ResetValues() { isFlying = false; isFlyingPending = false; flySpeed = 0; isStumbling = false; onGround = true; prevHitHashCode = -1; canUpdatePosition = true; playerAnimation.ResetValues(); turnTime = -simultaneousTurnPreventionTime; platformObject = null; currentSlotPosition = SlotPosition.Center; targetHorizontalPosition = (int)currentSlotPosition * ObjectGenerator.instance.slotDistance; totalMoveDistance = 0; curveOffset = Vector3.zero; turnOffset = prevTurnOffset = Vector3.zero; forwardSpeeds.ResetValues(); thisTransform.position = startPosition; thisTransform.rotation = startRotation; targetRotation = startRotation; UpdateTargetPosition(targetRotation.eulerAngles.y); }
/* * void Update () * { * Frame frame = controller.Frame (); * HandList hands = frame.Hands; * * if (!hands.IsEmpty) { * hand = hands [0]; * * // y-axis movement * float pitch = hand.Direction.Pitch; * if (pitch > minPitch) { * PlayerController.instance.Fly (Mathf.InverseLerp (minPitch, maxPitch, pitch)); * } * * Dir currDirection; * * Debug.Log (hands [0].PalmNormal.Roll.ToString ()); * * * // detect if there is any gesture * if (!frame.Gestures ().IsEmpty) { * isMovingLeft = false; * isMovingRight = false; * foreach (Gesture gesture in frame.Gestures()) { * if (gesture.Type == Gesture.GestureType.TYPESWIPE) { * SwipeGesture swipe = new SwipeGesture (gesture); * if (isLeftSwipe (swipe)) { * isMovingLeft = true; * } else if (isRightSwipe (swipe)) { * isMovingRight = true; * } * } * } * * if (isMovingLeft) { * if (isMovingRight) { * currDirection = Dir.none; * } else { * currDirection = Dir.left; * } * } else { * if (isMovingRight) { * currDirection = Dir.right; * } else { * currDirection = Dir.none; * } * } * } else { * currDirection = Dir.none; * } * * // compare the direction of the gesture of the current frame * // with that of the previous frame * switch (prevDirection) { * * case Dir.left: * if (currDirection == Dir.none) { * prevDirection = Dir.none; * } else if (currDirection == Dir.right) { * prevDirection = Dir.right; * goRight (); * } * break; * * case Dir.none: * if (currDirection == Dir.left) { * prevDirection = Dir.left; * goLeft (); * } else if (currDirection == Dir.right) { * prevDirection = Dir.right; * goRight (); * } * break; * * case Dir.right: * if (currDirection == Dir.none) { * prevDirection = Dir.none; * } else if (currDirection == Dir.left) { * prevDirection = Dir.left; * goLeft (); * } * break; * } * } * } */ void Update() { frame = controller.Frame(); HandList hands = frame.Hands; if (!hands.IsEmpty) { hand = hands [0]; // y-axis movement float pitch = hand.Direction.Pitch; if (pitch > minPitch) { PlayerController.instance.Fly(Mathf.InverseLerp(minPitch, maxPitch, pitch)); } // changing lane SlotPosition charPosition = PlayerController.instance.GetCurrentSlotPosition(); SlotPosition handPosition = getHandSlotPosition(); changeLane(charPosition, handPosition); // turning turn(); } }
private void EraseSlotPosition(int preset_index, SlotPosition sp) { for (int i = 0; i < m_Skills.Count; i++) { if (sp == m_Skills[i].Postions.Presets[preset_index]) { m_Skills[i].Postions.Presets[preset_index] = SlotPosition.SP_None; } } }
public void ChangeSlots(SlotPosition targetSlot) { if (targetSlot == currentSlotPosition) { return; } currentSlotPosition = targetSlot; targetSlotValue = (int)currentSlotPosition * distanceLane; UpdateTargetPosition(); }
void changeLane(SlotPosition charPosition, SlotPosition handPosition) { if (handPosition < charPosition) { PlayerController.instance.ChangeSlots(false); } else if (handPosition > charPosition) { PlayerController.instance.ChangeSlots(true); } }
// There are three slots on a track. The accelorometer/swipes determine the slot position public void ChangeSlots(SlotPosition targetSlot) { if (targetSlot == currentSlotPosition) { return; } currentSlotPosition = targetSlot; targetHorizontalPosition = (int)currentSlotPosition * ObjectGenerator.instance.slotDistance; UpdateTargetPosition(targetRotation.eulerAngles.y); }
internal void MountSkill(int preset_index, int skill_id, SlotPosition sp) { EraseSlotPosition(preset_index, sp); for (int i = 0; i < m_Skills.Count; i++) { if (skill_id == m_Skills[i].ID) { m_Skills[i].Postions.Presets[preset_index] = sp; break; } } }
// There are three slots on a track. The accelorometer determins the slot position public void changeSlots(SlotPosition targetSlot) { if (targetSlot == currentSlotPosition) { return; } currentSlotPosition = targetSlot; targetSlotValue = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; updateTargetPosition(thisTransform.eulerAngles.y); }
protected override void DrawSlot(Control ctrl, Point p, SlotPosition position, SlotDirection direction) { Graphics g = ctrl.CreateGraphics(); //UI ui = new UI(); SolidBrush brush = new SolidBrush(UI.SLOT_COLOR); Pen pen = new Pen(brush, 0.5f); Point pN = new Point(0, 0); Point pS = new Point(0, 0); Point pW = new Point(0, 0); Point pE = new Point(0, 0); Point[] points = new Point[3]; // this is the only situation possible for the tee if (position.Equals(SlotPosition.Right)) { if (direction == SlotDirection.Out) { pE = new Point(p.X - 1, p.Y); pS = new Point(pE.X - 3, pE.Y + 3); pW = new Point(pE.X - 11, pE.Y); pN = new Point(pE.X - 3, pE.Y - 3); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } } else if (position.Equals(SlotPosition.Left)) { if (direction == SlotDirection.In) { pW = p; pS = p; pN = p; pE = new Point(p.X + 5, p.Y); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } } g.FillPolygon(brush, points); g.Dispose(); brush.Dispose(); pen.Dispose(); }
public SlotPosition GetIdleSkillSlot() { SlotPosition pos = SlotPosition.SP_None; for (int i = 0; i < skillStorageArr.Length; i++) { if (skillStorageArr[i].SkillId <= 0) { pos = (SlotPosition)(i + 1); break; } } return(pos); }
//Set a new botpart in the botpart slot public void SetSlotBotPart(SlotPosition slotPosition, GameObject botPartGameObject) { //get slot using slot position GameObject slot = GetSlot(slotPosition); //check if any other gameobjects are located on this slot if (slot.transform.childCount > 0) { //destroy gameobject on this slot Object.Destroy(GetSlotBotPartGameObject(slot)); } //Instantiate botpart gameobject and parent it to this slot Object.Instantiate(botPartGameObject, slot.transform.position, slot.transform.rotation, slot.transform); }
public void ResetValues(bool fromRevive) { StopSlide(true); slideData.duration = 0; stumbleData.duration = 0; jumpSpeed = 0; isJumping = false; isJumpPending = false; isSliding = false; isStumbling = false; onGround = true; prevHitTransform = null; canUpdatePosition = true; playerAnimation.ResetValues(); if (projectileManager) { projectileManager.ResetValues(); } pauseCollisionParticlePlaying = false; turnTime = -simultaneousTurnPreventionTime; jumpLandTime = Time.time; platformObject = null; curveTime = -1; curveMoveDistance = 0; curveDistanceMapIndex = 0; followCurve = false; if (!fromRevive) { currentSlotPosition = SlotPosition.Center; targetHorizontalPosition = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; totalMoveDistance = 0; turnOffset = prevTurnOffset = Vector3.zero; curveOffset = Vector3.zero; forwardSpeeds.ResetValues(); thisTransform.position = startPosition; thisTransform.rotation = startRotation; targetRotation = startRotation; UpdateTargetPosition(targetRotation.eulerAngles.y); reviveTime = -1; } else { reviveTime = Time.time; } }
private void OnChipSwipeRequested(SlotPosition slotPosition, Vector2Int direction) { if (IsChipsMoving) { return; } DoSlotChipSwapWithAnimation(slotPosition, direction); // when animation has finished trigger find mathes code // if match has been found then do nothing, // if match has not been found then play reverse animation }
// There are three slots on a track. The accelorometer/swipes determine the slot position public void ChangeSlots(SlotPosition targetSlot) { if (targetSlot == currentSlotPosition) { return; } if (!InAir()) { playerAnimation.Strafe((int)currentSlotPosition < (int)targetSlot); } currentSlotPosition = targetSlot; targetHorizontalPosition = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; UpdateTargetPosition(targetRotation.eulerAngles.y); }
private void AutoEquipSkill(int skill_id) { if (skill_id <= 0 || null == LobbyClient.Instance.CurrentRole) { return; } UnityEngine.GameObject go = UIManager.Instance.TryGetWindowGameObject("SkillPanel"); if (null != go) { SlotPosition pos = go.GetComponent <UISkillPanel>().uiSkillSetting.GetIdleSkillSlot(); if ((int)pos > 0) { LogicSystem.PublishLogicEvent("ge_mount_skill", "lobby", UISkillSetting.presetIndex, skill_id, pos); } } }
internal void SwapSkill(int preset_index, int skill_id, SlotPosition source_pos, SlotPosition target_pos) { for (int i = 0; i < m_Skills.Count; i++) { if (target_pos == m_Skills[i].Postions.Presets[preset_index]) { m_Skills[i].Postions.Presets[preset_index] = source_pos; break; } } for (int i = 0; i < m_Skills.Count; i++) { if (skill_id == m_Skills[i].ID) { m_Skills[i].Postions.Presets[preset_index] = target_pos; break; } } }
// public void OnExchangeSkill(int sourceSkillId, int targetSkillId, SlotPosition sourcePos, SlotPosition targetPos) { int presetIndex = UISkillSetting.presetIndex; foreach (UISkillSlot slot in skillStorageArr) { if (slot != null && slot.SkillId == -1) { continue; } if (slot != null && slot.SkillId == sourceSkillId && slot.EquipedPos != null) { slot.EquipedPos.Presets[presetIndex] = targetPos; } if (slot != null && slot.SkillId == targetSkillId && slot.EquipedPos != null) { slot.EquipedPos.Presets[presetIndex] = sourcePos; } } }
private void CheckHorizontalPosition(float tiltValue) { if (freeHorizontalMovement) { playerController.MoveHorizontally(tiltValue); } else { SlotPosition currentSlot = playerController.GetCurrentSlotPosition(); switch (currentSlot) { case SlotPosition.Center: if (tiltValue < -accelerometerRightSlotValue) { playerController.ChangeSlots(SlotPosition.Left); } else if (tiltValue > accelerometerRightSlotValue) { playerController.ChangeSlots(SlotPosition.Right); } break; case SlotPosition.Left: if (tiltValue > -accelerometerRightSlotValue + accelerometerSensitivity) { playerController.ChangeSlots(SlotPosition.Center); } break; case SlotPosition.Right: if (tiltValue < accelerometerRightSlotValue - accelerometerSensitivity) { playerController.ChangeSlots(SlotPosition.Center); } break; } } }
public void ExchangeSlot(SlotPosition sourcePos, SlotPosition targetPos) { int sourceIndex = (int)sourcePos; int targetIndex = (int)targetPos; if (sourceIndex <= 0 || sourceIndex > 4 || targetIndex <= 0 || targetIndex > 4) { return; } UISkillSlot draged = skillStorageArr[sourceIndex - 1]; UISkillSlot surface = skillStorageArr[targetIndex - 1]; if (draged == null || surface == null) { return; } int surfaceSkillId = surface.SkillId; surface.SkillId = draged.SkillId; surface.SetSlotIconById(surface.SkillId); draged.SkillId = surfaceSkillId; draged.SetSlotIconById(surfaceSkillId); }
// public void HandleSwapSkill(int presetIndex, int skillId, SlotPosition sourcePos, SlotPosition targetPos, ArkCrossEngine.Network.GeneralOperationResult result) { try { if (ArkCrossEngine.Network.GeneralOperationResult.LC_Succeed == result) { string msg = string.Format("OnSwapSkill:{0},{1}", sourcePos, targetPos); Debug.Log(msg); int targetSkillId = uiSkillSetting.GetSkillId((int)targetPos); uiSkillSetting.ExchangeSlot(sourcePos, targetPos); uiSkillStorage.OnExchangeSkill(skillId, targetSkillId, sourcePos, targetPos); } else { string chn_desc = StrDictionaryProvider.Instance.GetDictString(364); LogicSystem.EventChannelForGfx.Publish("ge_screen_tip", "ui", chn_desc, UIScreenTipPosEnum.AlignTop, UnityEngine.Vector3.zero); } } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
public void reset() { thisTransform.position = startPosition; thisTransform.rotation = startRotation; slideData.duration = 0; isJumping = false; isJumpPending = false; isSliding = false; currentSlotPosition = SlotPosition.Center; targetSlotValue = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; thisRigidbody.useGravity = true; playerAnimation.reset(); pauseCollisionParticlePlaying = false; pausePowerUpParticlePlaying = false; totalMoveDistance = 0; turnOffset = Vector3.zero; turnTime = Time.time; targetRotation = startRotation; updateTargetPosition(targetRotation.eulerAngles.y); forwardSpeeds.init(); }
protected virtual void DrawSlot(Control ctrl, Point p, SlotPosition position, SlotDirection direction) { Graphics g = ctrl.CreateGraphics(); UI ui = new UI(); SolidBrush brush = new SolidBrush(ui.SLOT_COLOR); Pen pen = new Pen(brush, 0.5f); Point pN = new Point(0, 0); Point pS = new Point(0, 0); Point pW = new Point(0, 0); Point pE = new Point(0, 0); Point[] points = new Point[3]; if (position.Equals(SlotPosition.Up)) { if (direction == SlotDirection.In) { pN = p; pS = new Point(p.X, p.Y + 5); pW = new Point(p.X - 3, p.Y + 2); pE = new Point(p.X + 3, p.Y + 2); points[0] = pW; points[1] = pE; points[2] = pS; g.DrawLine(pen, pN, pS); } else if (direction == SlotDirection.Out) { pN = new Point(p.X, p.Y + 1); pS = new Point(p.X, p.Y + 5); pW = new Point(p.X - 4, p.Y + 4); pE = new Point(p.X + 4, p.Y + 4); points[0] = pW; points[1] = pE; points[2] = pN; g.DrawLine(pen, pN, pS); } } else if (position.Equals(SlotPosition.Left)) { if (direction == SlotDirection.In) { pW = p; pS = new Point(p.X + 2, p.Y + 3); pN = new Point(p.X + 2, p.Y - 3); pE = new Point(p.X + 5, p.Y); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } else if (direction == SlotDirection.Out) { pW = new Point(p.X + 1, p.Y); pS = new Point(p.X + 4, p.Y + 3); pN = new Point(p.X + 4, p.Y - 3); pE = new Point(p.X + 5, p.Y); points[0] = pN; points[1] = pS; points[2] = pW; g.DrawLine(pen, pW, pE); } } else if (position.Equals(SlotPosition.Right)) { if (direction == SlotDirection.Out) { pE = new Point(p.X - 1, p.Y); pS = new Point(pE.X - 3, pE.Y + 3); pW = new Point(pE.X - 5, pE.Y); pN = new Point(pE.X - 3, pE.Y - 3); points[0] = pN; points[1] = pE; points[2] = pS; g.DrawLine(pen, pW, pE); } else if (direction == SlotDirection.In) { pE = new Point(p.X - 1, p.Y); pS = new Point(pE.X - 3, pE.Y + 3); pW = new Point(pE.X - 6, pE.Y); pN = new Point(pE.X - 3, pE.Y - 3); points[0] = pN; points[1] = pS; points[2] = pW; g.DrawLine(pen, pW, pE); } } else if (position.Equals(SlotPosition.Down)) { if (direction == SlotDirection.Out) { pS = new Point(p.X, p.Y - 1); pN = new Point(pS.X, pS.Y - 5); pW = new Point(pS.X - 3, pS.Y - 3); pE = new Point(pS.X + 3, pS.Y - 3); points[0] = pW; points[1] = pE; points[2] = pS; g.DrawLine(pen, pN, pS); } else if (direction == SlotDirection.In) { pS = new Point(p.X, p.Y - 1); pN = new Point(pS.X, pS.Y - 6); pW = new Point(pS.X - 3, pS.Y - 2); pE = new Point(pS.X + 3, pS.Y - 2); points[0] = pW; points[1] = pE; points[2] = pN; g.DrawLine(pen, pN, pS); } } g.FillPolygon(brush, points); }
public void ResetValues(bool fromRevive) { slideData.duration = 0; stumbleData.duration = 0; jumpSpeed = 0; isJumping = false; isJumpPending = false; isSliding = false; isStumbling = false; onGround = true; prevHitTransform = null; canUpdatePosition = true; playerAnimation.ResetValues(); if (projectileManager) projectileManager.ResetValues(); pauseCollisionParticlePlaying = false; turnTime = -simultaneousTurnPreventionTime; jumpLandTime = Time.time; platformObject = null; curveTime = -1; curveMoveDistance = 0; curveDistanceMapIndex = 0; followCurve = false; if (!fromRevive) { currentSlotPosition = SlotPosition.Center; targetHorizontalPosition = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; totalMoveDistance = 0; turnOffset = prevTurnOffset = Vector3.zero; curveOffset = Vector3.zero; forwardSpeeds.ResetValues(); thisTransform.position = startPosition; thisTransform.rotation = startRotation; targetRotation = startRotation; UpdateTargetPosition(targetRotation.eulerAngles.y); reviveTime = -1; } else { reviveTime = Time.time; } }
public void reset() { thisTransform.position = startPosition; thisTransform.rotation = startRotation; slideData.duration = 0; stumbleData.duration = 0; jumpSpeed = 0; isJumping = false; isJumpPending = false; isSliding = false; isStumbling = false; onGround = true; prevHitHashCode = -1; currentSlotPosition = SlotPosition.Center; targetSlotValue = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; playerAnimation.reset(); if (projectileManager) projectileManager.reset(); pauseCollisionParticlePlaying = false; totalMoveDistance = 0; turnOffset = Vector3.zero; curveOffset = Vector3.zero; turnTime = Time.time; jumpLandTime = Time.time; forwardSpeeds.reset(); platformObject = null; curveTime = -1; curveMoveDistance = 0; curveDistanceMapIndex = 0; followCurve = false; targetRotation = startRotation; updateTargetPosition(targetRotation.eulerAngles.y); }
// There are three slots on a track. The accelorometer/swipes determine the slot position public void changeSlots(SlotPosition targetSlot) { if (targetSlot == currentSlotPosition) return; if (!inAir()) playerAnimation.strafe((int)currentSlotPosition < (int)targetSlot); currentSlotPosition = targetSlot; targetSlotValue = (int)currentSlotPosition * infiniteObjectGenerator.slotDistance; updateTargetPosition(targetRotation.eulerAngles.y); }