private void btnOkay_Click(object sender, EventArgs e) { mEditingRoute.CopyFrom(mTmpMoveRoute); mEditingRoute.Target = Guid.Empty; if (mEditingCommand != null) { if (!mEditingEvent.CommonEvent) { if (cmbTarget.SelectedIndex == 0) { mEditingRoute.Target = Guid.Empty; } else { mEditingRoute.Target = mCurrentMap.LocalEvents.Keys.ToList()[cmbTarget.SelectedIndex - 1]; } } mEventEditor.FinishCommandEdit(true); } mEventEditor.CloseMoveRouteDesigner(this); }
public EventPageInstance( EventBase myEvent, EventPage myPage, Guid mapId, Event eventIndex, Player player ) : base(Guid.NewGuid()) { BaseEvent = myEvent; Id = BaseEvent.Id; MyPage = myPage; MapId = mapId; X = eventIndex.X; Y = eventIndex.Y; Name = myEvent.Name; MovementType = MyPage.Movement.Type; MovementFreq = MyPage.Movement.Frequency; MovementSpeed = MyPage.Movement.Speed; DisablePreview = MyPage.DisablePreview; Trigger = MyPage.Trigger; Passable = MyPage.Passable; HideName = MyPage.HideName; MyEventIndex = eventIndex; MoveRoute = new EventMoveRoute(); MoveRoute.CopyFrom(MyPage.Movement.Route); mPathFinder = new Pathfinder(this); SetMovementSpeed(MyPage.Movement.Speed); MyGraphic.Type = MyPage.Graphic.Type; MyGraphic.Filename = MyPage.Graphic.Filename; MyGraphic.X = MyPage.Graphic.X; MyGraphic.Y = MyPage.Graphic.Y; MyGraphic.Width = MyPage.Graphic.Width; MyGraphic.Height = MyPage.Graphic.Height; Sprite = MyPage.Graphic.Filename; mDirectionFix = MyPage.DirectionFix; mWalkingAnim = MyPage.WalkingAnimation; mRenderLayer = MyPage.Layer; if (MyGraphic.Type == EventGraphicType.Sprite) { switch (MyGraphic.Y) { case 0: Dir = 1; break; case 1: Dir = 2; break; case 2: Dir = 3; break; case 3: Dir = 0; break; } } if (myPage.AnimationId != Guid.Empty) { Animations.Add(myPage.AnimationId); } Face = MyPage.FaceGraphic; mPageNum = BaseEvent.Pages.IndexOf(MyPage); Player = player; SendToPlayer(); }
public EventMoveRouteDesigner( FrmEvent eventEditor, MapBase currentMap, EventBase currentEvent, EventMoveRoute editingRoute, SetMoveRouteCommand editingCommand = null ) { InitializeComponent(); InitLocalization(); foreach (var item in lstCommands.Nodes) { var parentNode = new TreeNode(((TreeNode)item).Text) { Name = ((TreeNode)item).Name, Tag = ((TreeNode)item).Tag }; foreach (var childItem in ((TreeNode)item).Nodes) { var childNode = new TreeNode(((TreeNode)childItem).Text) { Name = ((TreeNode)childItem).Name, Tag = ((TreeNode)childItem).Tag }; parentNode.Nodes.Add(childNode); } mOrigItems.Add(parentNode); } //Grab event editor reference mEventEditor = eventEditor; mEditingEvent = currentEvent; mEditingCommand = editingCommand; mCurrentMap = currentMap; //Generate temp route to edit mTmpMoveRoute = new EventMoveRoute(); mTmpMoveRoute.CopyFrom(editingRoute); mEditingRoute = editingRoute; //Setup form chkIgnoreIfBlocked.Checked = mTmpMoveRoute.IgnoreIfBlocked; chkRepeatRoute.Checked = mTmpMoveRoute.RepeatRoute; cmbTarget.Items.Clear(); if (!mEditingEvent.CommonEvent) { if (mEditingCommand != null) { cmbTarget.Items.Add(Strings.EventMoveRoute.player); if (mEditingCommand.Route.Target == Guid.Empty) { cmbTarget.SelectedIndex = 0; } } foreach (var evt in mCurrentMap.LocalEvents) { cmbTarget.Items.Add( evt.Key == mEditingEvent.Id ? Strings.EventMoveRoute.thisevent.ToString() : "" + evt.Value.Name ); if (mEditingCommand != null) { if (mEditingCommand.Route.Target == evt.Key) { cmbTarget.SelectedIndex = cmbTarget.Items.Count - 1; } } else { if (mEditingRoute.Target == evt.Key || mEditingRoute.Target == Guid.Empty) { cmbTarget.SelectedIndex = cmbTarget.Items.Count - 1; } } } } if (cmbTarget.SelectedIndex == -1 && cmbTarget.Items.Count > 0) { cmbTarget.SelectedIndex = 0; } ListMoveRoute(); lstCommands.ExpandAll(); }