コード例 #1
0
            public Section(Move move, State state)
            {
                this.move = move;
                switch (state)
                {
                case State.Attack:
                    attackIcon = new AttackIcon();
                    attackIcon.setTexture(AttackIcon.attackIcon);
                    break;

                case State.SoloAbility:
                    castIcon = new CastIcon();
                    castIcon.setTexture(CastIcon.castIcon);
                    break;

                case State.TargetAbility:
                    targetIcon = new TargetIcon();
                    targetIcon.setTexture(TargetIcon.targetIcon);
                    break;

                case State.PlayCard:
                    playIcon = new PlayIcon();
                    playIcon.setTexture(PlayIcon.playIcon);
                    break;
                }



                this.state = state;
                //attackIcon.setScale(CardScale.Hand);
            }
コード例 #2
0
    public void InitializeCharacterPanel()
    {
        _battleSystem = GetComponentInParent <BattleSystem>();
        _battleField  = FindObjectOfType <BattleField>();
        _targetIcon   = FindObjectOfType <TargetIcon>();

        foreach (PlayerBattlePlacement pb in _battleField._playerBattlePlacement)
        {
            if (pb._battlePosition == _characterPanelNumber)
            {
                _myCharacter = pb._mycharacterBattler;
            }
        }

        if (_myCharacter == null)
        {
            return;                       /// Stop the Initialization
        }
        _characterIcon      = _myCharacter.GetComponentInChildren <CharacterIcon>();
        _characterAbilities = _myCharacter.GetComponent <CharacterAbilities>();

        _targetManager  = new TargetManager(_battleField._playerBattlePlacement, _battleField._enemyBattlePlacement, _characterAbilities, _targetIcon);
        _uiPanelChanger = GetComponent <UIPanelChanger>();

        _magicPanelManager = GetComponentInChildren <MagicPanelManager>();
        _magicPanelManager.InitializeMagicPanels(_characterAbilities._classSkills);

        _isInitialized = true;
    }
コード例 #3
0
 private void Awake()
 {
     _character          = GetComponent <Character>();
     _characterAbilities = GetComponent <CharacterAbilities>();
     _battleField        = FindObjectOfType <BattleField>();
     _targetIcon         = FindObjectOfType <TargetIcon>();
     _battleSystem       = FindObjectOfType <BattleSystem>();
 }
コード例 #4
0
    public TargetManager(BattlePlacement[] allyBattlePlacements, BattlePlacement[] enemyBattlePlacements, CharacterAbilities characterAbilities, TargetIcon targetIcon)
    {
        _characterAbilities = characterAbilities;
        _targetIcon         = targetIcon;

        _allyBattlePlacements  = allyBattlePlacements;
        _enemyBattlePlacements = enemyBattlePlacements;
        ResetTargets();
    }
コード例 #5
0
        private void OnTriggerExit(Collider other)
        {
            TargetIcon targetIcon = other.GetComponent <TargetIcon>();

            if (targetIcon)
            {
                targetIcon.IconExitLoadedNotes();
            }
        }
コード例 #6
0
        private void OnTriggerEnter(Collider other)
        {
            TargetIcon targetIcon = other.GetComponent <TargetIcon>();

            if (targetIcon)
            {
                //Timeline.AddLoadedNote(target);
                targetIcon.IconEnterLoadedNotes();
            }
        }
コード例 #7
0
ファイル: PlaceNote.cs プロジェクト: MeepsKitten/NotReaper
        public void TryRemoveNote()
        {
            var        iconsUnderMouse = MouseUtil.IconsUnderMouse(timeline);
            TargetIcon targetIcon      = iconsUnderMouse.Length > 0 ? iconsUnderMouse[0] : null;

            if (targetIcon)
            {
                targetIcon.OnTryRemove();
            }
        }
コード例 #8
0
ファイル: PlaceNote.cs プロジェクト: jukibom/NotReaper
        public void TryRemoveNote()
        {
            //if (EventSystem.current.IsPointerOverGameObject())
            //return;

            TargetIcon targetIcon = IconUnderMouse();

            if (targetIcon)
            {
                targetIcon.OnTryRemove();
            }
        }
コード例 #9
0
ファイル: DragSelect.cs プロジェクト: aggrogahu/NotReaper
        private void StartDragTimelineTargetAction(TargetIcon icon)
        {
            isDraggingNotesOnTimeline = true;
            startTimelineMoveTime     = icon.data.beatTime;
            timelineTargetMoveIntents = new List <TargetTimelineMoveIntent>();
            timeline.selectedNotes.ForEach(target => {
                var intent       = new TargetTimelineMoveIntent();
                intent.target    = target.data;
                intent.startTime = target.data.beatTime;

                timelineTargetMoveIntents.Add(intent);
            });
        }
コード例 #10
0
ファイル: DragSelect.cs プロジェクト: aggrogahu/NotReaper
        private void StartDragGridTargetAction(TargetIcon icon)
        {
            isDraggingNotesOnGrid = true;
            startGridMovePos      = icon.data.position;

            gridTargetMoveIntents = new List <TargetGridMoveIntent>();
            timeline.selectedNotes.ForEach(target => {
                var intent              = new TargetGridMoveIntent();
                intent.target           = target.data;
                intent.startingPosition = new Vector2(target.data.x, target.data.y);

                gridTargetMoveIntents.Add(intent);
            });
        }
コード例 #11
0
ファイル: DragSelect.cs プロジェクト: jukibom/NotReaper
        private void TryToggleSelection()
        {
            var        iconsUnderMouse = MouseUtil.IconsUnderMouse(notesLayer);
            TargetIcon iconUnderMouse  = iconsUnderMouse.Length > 0 ? iconsUnderMouse[0] : null;

            if (iconUnderMouse && iconUnderMouse.isSelected)
            {
                iconUnderMouse.TryDeselect();
            }
            else if (iconUnderMouse && !iconUnderMouse.isSelected)
            {
                iconUnderMouse.TrySelect();
            }
        }
コード例 #12
0
ファイル: DragSelect.cs プロジェクト: jukibom/NotReaper
        private void StartDragTimelineTargetAction(TargetIcon icon)
        {
            isDraggingNotesOnTimeline = true;
            startDragMovePos          = icon.transform.position;

            timelineTargetMoveIntents = new List <TargetMoveIntent>();
            timeline.selectedNotes.ForEach(target => {
                var intent = new TargetMoveIntent();
                var pos    = target.timelineTargetIcon.transform.localPosition;

                intent.target           = target;
                intent.startingPosition = new Vector3(pos.x, pos.y, pos.z);

                timelineTargetMoveIntents.Add(intent);
            });
        }
コード例 #13
0
ファイル: PlaceNote.cs プロジェクト: jukibom/NotReaper
        private TargetIcon IconUnderMouse()
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            ray.origin    = new Vector3(ray.origin.x, ray.origin.y, -1.7f);
            ray.direction = Vector3.forward;
            Debug.DrawRay(ray.origin, ray.direction);
            if (Physics.Raycast(ray, out hit, 3.4f, notesLayer))
            {
                Transform objectHit = hit.transform;

                TargetIcon targetIcon = objectHit.GetComponent <TargetIcon>();

                return(targetIcon);
            }
            return(null);
        }
コード例 #14
0
        public void RefreshTargets()
        {
            // Updates location of each target icon based on worldMap offset and size
            if (targetIcons.Count == 0)
            {
                // Load icons from targets
                foreach (TargetElement te in Targetdeck.Targets)
                {
                    if (te.Position.PositionType == PositionType.StaticLLA)
                    {
                        TargetIcon t         = new TargetIcon(te);
                        double     longitude = te.Position.Ics[0];
                        double     latitude  = te.Position.Ics[1];
                        int        controlX  = Conversion.Longitude2Pixel(longitude, worldMap.Width);
                        int        controlY  = Conversion.Latitude2Pixel(latitude, worldMap.Height);
                        int        iconX     = worldMap.Location.X + controlX;
                        int        iconY     = worldMap.Location.Y + controlY;
                        t.Location = new Point(iconX / 2, iconY / 2);
                        t.Parent   = this;
                        t.BringToFront();
                        targetIcons.Add(t);
                    }
                }
            }

            foreach (TargetIcon t in targetIcons)
            {
                if (((TargetElement)t.Tag).Position.PositionType == Hsf.Utility.PositionType.StaticLLA)
                {
                    double longitude = ((TargetElement)t.Tag).Position.Ics[0];
                    double latitude  = ((TargetElement)t.Tag).Position.Ics[1];
                    int    controlX  = Conversion.Longitude2Pixel(longitude, worldMap.Width);
                    int    controlY  = Conversion.Latitude2Pixel(latitude, worldMap.Height);
                    int    iconX     = worldMap.Location.X + controlX;
                    int    iconY     = worldMap.Location.Y + controlY;
                    t.Location = new Point(iconX, iconY);
                }
            }
        }
コード例 #15
0
        public void OnControlMove(object sender, MouseEventArgs e)
        {
            // A target control was moved; update positions
            TargetIcon icon      = (TargetIcon)sender;
            int        iconX     = icon.Location.X;
            int        iconY     = icon.Location.Y;
            int        controlX  = iconX - worldMap.Location.X;
            int        controlY  = iconY - worldMap.Location.Y;
            double     longitude = Conversion.Pixel2Longitude(controlX, worldMap.Width);
            double     latitude  = Conversion.Pixel2Latitude(controlY, worldMap.Height);

            // Change location and register event with memento
            TargetElement target = (TargetElement)icon.Tag;
            TargetElement before = (TargetElement)target.Clone();

            target.Position.Ics[0] = longitude;
            target.Position.Ics[1] = latitude;
            target.Position.Ics[2] = 0.0;
            TargetElement after = (TargetElement)target.Clone();

            _mManager.RegisterEvent(before, after, target, "Move Target");
        }
コード例 #16
0
        public void AddNewTarget(double latitude, double longitude)
        {
            //TargetdeckComponent before = Targetdeck.Clone();

            // Create new component (static LLA by default, since created on map)
            TargetElement newTarget = new TargetElement();

            newTarget.Position.PositionType = Hsf.Utility.PositionType.StaticLLA;
            newTarget.Position.Ics[0]       = longitude;
            newTarget.Position.Ics[1]       = latitude;
            Targetdeck.Targets.Add(newTarget);

            // Create new icon
            double     x       = (longitude + 180.0) * worldMap.Size.Width / 360.0;
            double     y       = (-1.0 * latitude + 90.0) * worldMap.Size.Height / 180.0;
            TargetIcon newIcon = new TargetIcon(newTarget);

            newIcon.Location = new Point((int)x, (int)y);
            newIcon.Visible  = true;
            targetIcons.Add(newIcon);
            Controls.Add(newIcon);
            newIcon.BringToFront();

            // Add target node
            TreeNode targetNode = new TreeNode(newTarget.TargetName);

            Node.Nodes.Add(targetNode);

            // Create new target form to attach to node
            TargetForm newForm = new TargetForm(newTarget, MdiParent, targetNode);

            targetNode.Tag = newForm;

            // Register event
            //_mManager.RegisterEvent(before, hComponent, hComponent, "Add Target");

            // Make sure target is displayed
            RefreshTargets();
        }
コード例 #17
0
ファイル: DragSelect.cs プロジェクト: jukibom/NotReaper
        void Update()
        {
            //If the user decides they hate productivity and want to unselect all their notes, so be it.
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.D))
            {
                timeline.DeselectAllTargets();
            }

            //Applying hitsounds to selected:

            if (!activated)
            {
                return;
            }


            //TODO: Add shift + ctrl detection up here instead of multipule times


            if (Input.GetKeyDown(KeyCode.Q))
            {
                SetHitsoundAction(TargetVelocity.Standard);
            }
            else if (Input.GetKeyDown(KeyCode.W))
            {
                SetHitsoundAction(TargetVelocity.Snare);
            }
            else if (Input.GetKeyDown(KeyCode.E))
            {
                SetHitsoundAction(TargetVelocity.Percussion);
            }
            else if (Input.GetKeyDown(KeyCode.R))
            {
                SetHitsoundAction(TargetVelocity.ChainStart);
            }
            else if (Input.GetKeyDown(KeyCode.T))
            {
                SetHitsoundAction(TargetVelocity.Chain);
            }
            else if (Input.GetKeyDown(KeyCode.Y))
            {
                SetHitsoundAction(TargetVelocity.Melee);
            }


            var        iconsUnderMouse = MouseUtil.IconsUnderMouse(notesLayer);
            TargetIcon iconUnderMouse  = iconsUnderMouse.Length > 0 ? iconsUnderMouse[0] : null;

            /** Click Detection **/
            if (isSelectionDown && !hasMovedOutOfClickBounds)
            {
                // Check for a tiny amount of mouse movement to ensure this was meant to be a click

                float movement = Math.Abs(startClickDetectPos.magnitude - Input.mousePosition.magnitude);
                if (movement > 2)
                {
                    hasMovedOutOfClickBounds = true;
                }
            }

            /** Cut Copy Paste Delete **/
            // TODO: Move these actions into timeline to record sane undo actions!
            Action delete = () => {
                if (timeline.selectedNotes.Count > 0)
                {
                    timeline.DeleteTargets(timeline.selectedNotes);
                }
                timeline.selectedNotes = new List <Target>();
            };

            Action copy = () => {
                clipboardNotes = new List <Cue>();
                timeline.selectedNotes.ForEach(note => clipboardNotes.Add(NotePosCalc.ToCue(note, 0, false)));
            };

            Action paste = () => {
                timeline.DeselectAllTargets();
                timeline.PasteCues(clipboardNotes, Timeline.BeatTime());
            };

            if (Input.GetKeyDown(KeyCode.Delete))
            {
                delete();
            }

            bool dev          = false;
            bool modifierHeld = dev ?
                                Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) :
                                Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);

            if (modifierHeld)
            {
                if (Input.GetKeyDown(KeyCode.X))
                {
                    copy();
                    delete();
                }

                if (Input.GetKeyDown(KeyCode.C))
                {
                    copy();
                }

                if (Input.GetKeyDown(KeyCode.V))
                {
                    paste();
                }
            }

            /** Note flipping **/
            if (Input.GetKeyDown(KeyCode.F))
            {
                var ctrlHeld  = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
                var shiftHeld = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);

                // flip horizontal
                if (ctrlHeld && !shiftHeld)
                {
                    timeline.FlipTargetsHorizontal(timeline.selectedNotes);
                }

                // flip vertical
                else if (shiftHeld)
                {
                    timeline.FlipTargetsVertical(timeline.selectedNotes);
                }

                // invert
                else
                {
                    timeline.SwapTargets(timeline.selectedNotes);
                }
            }

            /** Click + Drag Handling **/
            //TODOUNDO I think I fixed this? //TODO: it should deselect when resiszing the grid dragger, but not deselect when scrubbing through the timeline while grid dragging

            if (EditorInput.selectedTool == EditorTool.DragSelect)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    if (iconUnderMouse)
                    {
                        var anySelectedIconUnderMouse = iconsUnderMouse.Where(icon => icon.isSelected).ToArray();
                        if (anySelectedIconUnderMouse.Length == 0)
                        {
                            return;
                        }
                        switch (iconUnderMouse.location)
                        {
                        case TargetIconLocation.Grid:
                            StartDragGridTargetAction(iconUnderMouse);
                            break;

                        case TargetIconLocation.Timeline:
                            StartDragTimelineTargetAction(iconUnderMouse);
                            break;
                        }
                    }
                }

                if (Input.GetMouseButtonUp(0))
                {
                    if (isDraggingNotesOnGrid)
                    {
                        EndDragGridTargetAction();
                    }
                    if (isDraggingNotesOnTimeline)
                    {
                        EndDragTimelineTargetAction();
                    }

                    foreach (Target target in timeline.selectedNotes)
                    {
                        if (target.gridTargetIcon)
                        {
                            target.gridTargetPos = target.gridTargetIcon.transform.localPosition;
                        }
                    }
                }

                if (Input.GetMouseButton(0))
                {
                    //If we're not already dragging

                    if (!isDraggingTimeline &&
                        !isDraggingGrid &&
                        !isDraggingNotesOnGrid &&
                        !isDraggingNotesOnTimeline &&
                        !iconUnderMouse
                        )
                    {
                        if (timeline.hover)
                        {
                            StartTimelineDrag();
                        }
                        else
                        {
                            StartGridDrag();
                        }
                    }
                    else if (isDraggingTimeline)
                    {
                        float diff = Camera.main.ScreenToWorldPoint(Input.mousePosition).x - dragSelectTimeline.position.x;
                        float timelineScaleMulti = Timeline.scale / 20f;
                        dragSelectTimeline.localScale = new Vector3(diff * timelineScaleMulti, 1.1f * (Timeline.scale / 20f), 1);
                    }
                    else if (isDraggingGrid)
                    {
                        Vector3 diff = Camera.main.ScreenToWorldPoint(Input.mousePosition) - dragSelectGrid.transform.position;
                        dragSelectGrid.transform.localScale = new Vector3(diff.x, diff.y * -1, 1f);
                    }
                    else if (iconUnderMouse && !isSelectionDown)
                    {
                        StartSelectionAction();
                    }
                    else if (iconUnderMouse && timeline.selectedNotes.Count == 0 && hasMovedOutOfClickBounds)
                    {
                        iconUnderMouse.TrySelect();
                        if (iconUnderMouse.location == TargetIconLocation.Grid)
                        {
                            StartDragGridTargetAction(iconUnderMouse);
                        }
                        if (iconUnderMouse.location == TargetIconLocation.Timeline)
                        {
                            StartDragTimelineTargetAction(iconUnderMouse);
                        }
                    }
                }
                else
                {
                    if (isDraggingTimeline)
                    {
                        EndTimelineDrag();
                    }
                    else if (isDraggingGrid)
                    {
                        EndGridDrag();
                    }
                }
                if (Input.GetMouseButtonUp(0))
                {
                    EndSelectionAction();
                    if (!hasMovedOutOfClickBounds)
                    {
                        TryToggleSelection();
                    }
                }

                if (isDraggingNotesOnGrid)
                {
                    // TODO: this should really be handled by intermediary semi-transparent objects rather than updating "real" state as we go ...

                    var     mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                    Vector3 newPos   = NoteGridSnap.SnapToGrid(mousePos, EditorInput.selectedSnappingMode);

                    foreach (TargetMoveIntent intent in gridTargetMoveIntents)
                    {
                        //var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                        var offsetFromDragPoint = intent.target.gridTargetPos - startDragMovePos;
                        //Vector3 newPos = NoteGridSnap.SnapToGrid(mousePos, EditorInput.selectedSnappingMode);
                        var tempNewPos = newPos + offsetFromDragPoint;
                        intent.target.gridTargetIcon.transform.localPosition = new Vector3(tempNewPos.x, tempNewPos.y, intent.target.gridTargetPos.z);
                        if (intent.target.behavior == TargetBehavior.Hold)
                        {
                            var holdEnd = intent.target.gridTargetIcon.GetComponentInChildren <HoldTargetManager>().endMarker;
                            if (holdEnd)
                            {
                                holdEnd.transform.localPosition = new Vector3(tempNewPos.x, tempNewPos.y, holdEnd.transform.localPosition.z);
                            }
                        }

                        //target.gridTargetPos = target.gridTargetIcon.transform.localPosition;

                        intent.intendedPosition = new Vector3(tempNewPos.x, tempNewPos.y, intent.target.gridTargetPos.z);
                    }
                }

                if (isDraggingNotesOnTimeline)
                {
                    foreach (TargetMoveIntent intent in timelineTargetMoveIntents)
                    {
                        var pos     = intent.startingPosition;
                        var gridPos = intent.target.gridTargetIcon.transform.localPosition;

                        var mousePos            = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                        var offsetFromDragPoint = pos - startDragMovePos;

                        Vector3 newPos = SnapToBeat(mousePos);
                        // TODO: Snap!

                        newPos += offsetFromDragPoint;
                        intent.target.timelineTargetIcon.transform.localPosition = new Vector3(newPos.x, pos.y, pos.z);
                        intent.target.gridTargetIcon.transform.localPosition     = new Vector3(gridPos.x, gridPos.y, newPos.x);

                        intent.intendedPosition = new Vector3(newPos.x, pos.y, pos.z);
                    }
                }
            }
        }