예제 #1
0
        // Token: 0x06001477 RID: 5239 RVA: 0x00021EF4 File Offset: 0x00020EF4
        private void BuildWarpList()
        {
            uint collectionKey = base.Event.TrackLayoutDef.StartGrid().GetCollectionKey();
            Grid grid          = new Grid(collectionKey);

            foreach (EntrantInfo entrantInfo in base.Event.Entrants)
            {
                Location location = new Location();
                WarpTo   warpTo   = new WarpTo();
                grid.GetLocation(entrantInfo.Opponent.GridIndex, location);
                warpTo.Position  = location.GetPosition();
                warpTo.Direction = location.GetDirection();
                warpTo.Vehicle   = entrantInfo.Opponent.Vehicle;
                Console.WriteLine("Placing {0} in grid index {1}", entrantInfo.Opponent.OpponentName, entrantInfo.Opponent.GridIndex);
                this.warpList.Add(warpTo);
            }
        }
예제 #2
0
 // Token: 0x06001473 RID: 5235 RVA: 0x00021D6C File Offset: 0x00020D6C
 private void BuildWarpList()
 {
     foreach (EntrantInfo entrantInfo in base.Event.Entrants)
     {
         WarpTo warpTo = new WarpTo();
         uint   num    = base.Event.TrackLayoutDef.Num_SpawnLocation();
         if (num > 0u)
         {
             uint       index      = (uint)(entrantInfo.Opponent.GridIndex % (int)num);
             Collection collection = new Collection(base.Event.TrackLayoutDef.SpawnLocation(index));
             warpTo.Position  = CoordSys.RenderToSim(collection.Position());
             warpTo.Direction = CoordSys.Vector3Make(collection.Rotation());
             warpTo.Vehicle   = entrantInfo.Opponent.Vehicle;
             this.warpList.Add(warpTo);
         }
     }
 }
예제 #3
0
 public void TriggerSpawnEvent(CameraEdgeController alerted, EdgeCheck edge)  //Gets called when this camera's edge collider detects the player
 {
     if (UseWarp)
     {
         WarpTo destination = alerted.getWarp(edge.dir);
         if (!CameraPlayerMap[destination.cam].gameObject.activeInHierarchy) //If no other camera is currently using this player
         {
             PlayerMovement Clone  = CameraPlayerMap[destination.cam];
             PlayerMovement Source = CameraPlayerMap[alerted];
             Vector3        offset = edge.transform.position - Source.transform.position;
             Clone.transform.position = destination.edge.transform.position - offset;
             Clone.gameObject.SetActive(true);
             Clone.GetComponent <Rigidbody2D>().velocity = Source.GetComponent <Rigidbody2D>().velocity;
             //TODO: Keep player variables consistent
             //Clone.CopyState(Source);
         }
     }
 }
        /// <summary>
        /// Initialize the dialog
        /// </summary>
        /// <param name="nodeToEdit">The node we'll be editing</param>
        /// <param name="canEdit">True if we can open the maneuver node editing tools, false otherwise</param>
        public PlanningNodeEditDialog(PlanningNodeModel nodeToEdit, bool canEdit)
            : base(-1, -1, pad, new RectOffset(4, 4, 4, 4), TextAnchor.UpperLeft)
        {
            editingNode = nodeToEdit;

            var toprow = new List <DialogGUIBase>()
            {
                TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                   "PlanningNode_DeleteButtonCaption",
                                                   () => DeleteNode?.Invoke(),
                                                   buttonWidth, buttonHeight,
                                                   false
                                                   )
                {
                    tooltipText = "PlanningNode_DeleteButtonTooltip"
                }),
                new DialogGUIFlexibleSpace(),
                TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                   "PlanningNode_CloseButtonCaption",
                                                   () => CloseDialog?.Invoke(),
                                                   buttonWidth, buttonHeight,
                                                   false
                                                   )
                {
                    tooltipText = "PlanningNode_CloseButtonTooltip"
                })
            };

            if (canEdit)
            {
                toprow.Insert(0, TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                                    "PlanningNode_NewButtonCaption",
                                                                    () => NewNode?.Invoke(),
                                                                    buttonWidth, buttonHeight,
                                                                    false
                                                                    )
                {
                    tooltipText = "PlanningNode_NewButtonTooltip"
                }));
            }
            AddChild(new DialogGUIHorizontalLayout(
                         -1, -1, 8, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft,
                         toprow.ToArray()
                         ));
            AddChild(new DialogGUIHorizontalLayout(
                         -1, -1, pad, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft,
                         new DialogGUILabel("PlanningNode_NameLabelCaption", buttonWidth / 2),
                         NotifyOnFocus(new DialogGUITextInput(
                                           editingNode.name,
                                           false,
                                           24,
                                           s => { return(editingNode.name = s); },
                                           () => { return(editingNode.name); },
                                           TMP_InputField.ContentType.Standard,
                                           buttonHeight
                                           ),
                                       // Don't trigger other parts of the game while they're typing a name in the text field
                                       v => InputLockManager.SetControlLock(MyLocks, "PlanningNodeEditDialogName"),
                                       v => InputLockManager.RemoveControlLock("PlanningNodeEditDialogName")
                                       ),
                         TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                            "PlanningNode_PrevNodeCaption",
                                                            () => PrevNode?.Invoke(),
                                                            smallBtnWidth, buttonHeight,
                                                            false
                                                            )
            {
                tooltipText = canEdit ? "PlanningNode_PrevNodeTooltip" : "PlanningNode_PrevNodeViewOnlyTooltip"
            }),
                         TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                            "PlanningNode_NextNodeCaption",
                                                            () => NextNode?.Invoke(),
                                                            smallBtnWidth, buttonHeight,
                                                            false
                                                            )
            {
                tooltipText = canEdit ? "PlanningNode_NextNodeTooltip" : "PlanningNode_NextNodeViewOnlyTooltip"
            })
                         ));
            AddChild(new DialogGUIHorizontalLayout(
                         -1, -1, pad, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft,
                         new DialogGUILabel("PlanningNode_HueLabelCaption", buttonWidth / 2),
                         new DialogGUISlider(
                             () => {
                if (editingNode != null)
                {
                    Color.RGBToHSV(editingNode.color, out float hue, out float _, out float _);
                    return(hue);
                }
                return(0f);
            },
                             0f, 1f, false, -1, buttonHeight,
                             v => {
                if (editingNode != null)
                {
                    editingNode.color = Color.HSVToRGB(v, 0.5f, 0.75f);
                }
            }
                             )
                         ));
            if (canEdit)
            {
                AddChild(new DialogGUIHorizontalLayout(
                             -1, -1, pad, new RectOffset(0, 0, 0, 0), TextAnchor.MiddleLeft,
                             new DialogGUILabel("PlanningNode_BodyLabelCaption", buttonWidth / 2),
                             new DialogGUILabel(
                                 () => editingNode.origin.bodyName,
                                 -1
                                 ),
                             TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                                "PlanningNode_PrevBodyCaption",
                                                                () => BodyChanged?.Invoke(prevBody(editingNode.origin)),
                                                                smallBtnWidth, buttonHeight,
                                                                false
                                                                )
                {
                    tooltipText = "PlanningNode_PrevBodyTooltip"
                }),
                             TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                                "PlanningNode_NextBodyCaption",
                                                                () => BodyChanged?.Invoke(nextBody(editingNode.origin)),
                                                                smallBtnWidth, buttonHeight,
                                                                false
                                                                )
                {
                    tooltipText = "PlanningNode_NextBodyTooltip"
                })
                             ));
                AddChild(TooltipExtensions.DeferTooltip(new DialogGUIToggle(
                                                            () => editingNode.vessel == null,
                                                            "PlanningNode_ShowForAllCheckboxCaption",
                                                            b => { editingNode.vessel = b ? null : FlightGlobals.ActiveVessel; }
                                                            )
                {
                    tooltipText = "PlanningNode_ShowForAllCheckboxTooltip"
                }));
            }
            AddChild(TooltipExtensions.DeferTooltip(new DialogGUIButton(
                                                        "PlanningNode_WarpToCaption",
                                                        () => WarpTo?.Invoke(editingNode),
                                                        buttonWidth, buttonHeight,
                                                        false
                                                        )
            {
                tooltipText = "PlanningNode_WarpToTooltip"
            }));

            // Don't try to plot a maneuver from the Sun
            for (int i = 0; i < FlightGlobals.Bodies.Count; ++i)
            {
                var b = FlightGlobals.Bodies[i];
                if (b.referenceBody != null && b.referenceBody != b)
                {
                    allowedBodies.Add(b);
                }
            }
        }