Пример #1
0
        private void collectionPressed(object sender, MouseEventArgs e)
        {
            if (!ButtonControl.enableDrag)
            {
                if (!ButtonControl.enableDelete)
                {
                    int btnId = (int)((Button)sender).Tag;
                    buttonsStack.Push(btnId);

                    panelGUI.Controls.Clear();

                    foreach (var item in collectionButtons[btnId])
                    {
                        panelGUI.Controls.Add(item);
                    }

                    btnBackFromChild.Visible = true;

                    lblCurrentButtonID.Text = "";
                    foreach (int id in buttonsStack)
                    {
                        lblCurrentButtonID.Text += ($"/{allButtons[id].Text}");
                    }

                    if (searchActive)
                    {
                        Search();
                    }
                }
                else
                {
                    DragButton   btnPressed   = (DragButton)sender;
                    DialogResult dialogResult = MessageBox.Show("Delete?", btnPressed.Name, MessageBoxButtons.OKCancel);
                    if (dialogResult == DialogResult.OK)
                    {
                        if (collectionButtons[int.Parse(btnPressed.Tag.ToString())].Count > 0)
                        {
                            MessageBox.Show("To delete collection you must first delete all units it contains");
                            return;
                        }
                        try
                        {
                            ButtonsClient.DeleteButtonConnection(int.Parse(btnPressed.Tag.ToString()));
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Failed to delete");
                        }

                        allButtons.Remove(int.Parse(btnPressed.Tag.ToString()));
                        collectionButtons[buttonsStack.Peek()].Remove(btnPressed);
                        panelGUI.Controls.Remove(btnPressed);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                }
            }
        }
 public void GameOver_prop()
 {
     BackGroundPic.SetActive(true);
     JoyStickPanel_Left.SetActive(false);
     DragButton.SetActive(false);
     GameOver_Menu.SetActive(true);
     Destroy(Main_Camera.GetComponent <CameraFollow>());
 }
 void Start()
 {
     //Mission_id = ES2.Load<int>(Application.persistentDataPath+"/LvInfo.kanb?tag=Mission_id");
     Mission_id = PlayerPrefs.GetInt("Mission_id");
     StartCoroutine("MissionShow");
     JoyStickPanel_Left.SetActive(false);
     DragButton.SetActive(false);
     GameOver_Menu.SetActive(false);
 }
Пример #4
0
    void Start()
    {
        int i = 0;

        foreach (GameObject dragButton in DragButtons)
        {
            DragButton db = dragButton.AddComponent <DragButton>();
            db.dtp      = this;
            db.ShopItem = (Building)i;
            i++;
        }
    }
Пример #5
0
        public static DragButtonTransfer mapDragButtonToTransferButton(DragButton btnDrag)
        {
            DragButtonTransfer btnTransfer = new DragButtonTransfer();

            btnTransfer.Tag  = int.Parse(btnDrag.Tag.ToString());
            btnTransfer.Text = btnDrag.Text;
            btnTransfer.Name = btnDrag.Name;
            btnTransfer.Left = btnDrag.Left;
            btnTransfer.Top  = btnDrag.Top;
            btnTransfer.Type = btnDrag.Type;

            return(btnTransfer);
        }
Пример #6
0
    public void InitNodeFromDescriptor(NodeDescriptor descriptor)
    {
        nodeType = descriptor.nodeType;
        nodeName = descriptor.nodeName;
        titleBarColor = descriptor.titleBarColor;

        timePointer = new TimePointer();
        timePointer.hasTiming = descriptor.hasTiming;
        timePointer.InitTimePointer(descriptor.defaultAnimationLength);
        timePointer.parentNode = this;

        dragButton = new DragButton();
        dragButton.InitDragButton();
        
        parameters = new ParameterDictionary();
        foreach (KeyValuePair<string, NodeParameter> pair in descriptor.parameters)
        {
            NodeParameter tempParameter = new NodeParameter();
            tempParameter.floatParam = pair.Value.floatParam;
            tempParameter.stringParam = pair.Value.stringParam;
            tempParameter.vectorParam = new Vector3(pair.Value.vectorParam.x, pair.Value.vectorParam.y, pair.Value.vectorParam.z);
            tempParameter.type = pair.Value.type;

            parameters.Add(pair.Key, tempParameter);
        }

        for(int i = 0; i < descriptor.numberOfInputs; i++)
        {
            nodeInputs.Add(new NodeInput());
        }
        numberOfInputs = descriptor.numberOfInputs;
        nodeInputsMin = descriptor.minInputs;
        nodeInputsMax = descriptor.maxInputs;
        for (int i = 0; i < descriptor.numberOfOutputs; i++)
        {
            nodeOutputs.Add(new NodeOutput());
            if(nodeType != NodeType.Graph)
                nodeOutputs[i].outputNode = this;
        }
        numberOfOutputs = descriptor.numberOfOutputs;
        nodeOutputsMin = descriptor.minOutputs;
        nodeOutputsMax = descriptor.maxOutputs;

        multiInput = descriptor.isMultiInput;
        multiOutput = descriptor.isMultiOutput;

        nodeRect = new Rect(10f, 10f, 150f, 100f);
    }
    IEnumerator MissionShow()
    {
        Main_Camera.SetActive(false);
        UI_Camera.AddComponent <AudioListener>();
        UIAudioSrc.Play();
        yield return(new WaitForSeconds(UIAudioSrc.clip.length));

        Debug.LogWarning("10012_C02_wav.aax播放完毕,进入关卡");
        BackGroundPic.SetActive(false);
        ULabel.SetActive(false);
        Main_Camera.SetActive(true);
        Spotlight.SetActive(false);
        Scene_BGM.Play();
        JoyStickPanel_Left.SetActive(true);
        DragButton.SetActive(true);
        playerManager.loadJoyStick();
    }
Пример #8
0
        public static List <DragButton> mapTransferButtonsToDragButtons(List <DragButtonTransfer> transferButtons)
        {
            List <DragButton> returnList = new List <DragButton>();

            foreach (DragButtonTransfer btnTransfer in transferButtons)
            {
                DragButton btnDrag = new DragButton();
                btnDrag.Tag  = btnTransfer.Tag;
                btnDrag.Text = btnTransfer.Text;
                btnDrag.Name = btnTransfer.Name;
                btnDrag.Left = btnTransfer.Left;
                btnDrag.Top  = btnTransfer.Top;
                btnDrag.Type = btnTransfer.Type;
                returnList.Add(btnDrag);
            }

            return(returnList);
        }
Пример #9
0
        private void unitPressed(object sender, MouseEventArgs e)
        {
            if (!ButtonControl.enableDrag)
            {
                if (!ButtonControl.enableDelete)
                {
                    DragButton btnPressed = (DragButton)sender;

                    this.Hide();
                    //Send pressed button ID
                    StorageUnitTable unitTable = new StorageUnitTable(int.Parse(btnPressed.Tag.ToString()));
                    unitTable.Location      = this.Location;
                    unitTable.StartPosition = this.StartPosition;
                    unitTable.FormClosing  += delegate { this.Show(); };
                    unitTable.ShowDialog();
                }
                else
                {
                    DragButton   btnPressed   = (DragButton)sender;
                    DialogResult dialogResult = MessageBox.Show("Delete?", btnPressed.Name, MessageBoxButtons.OKCancel);
                    if (dialogResult == DialogResult.OK)
                    {
                        try
                        {
                            ButtonsClient.DeleteButtonConnection(int.Parse(btnPressed.Tag.ToString()));
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Failed to delete");
                        }

                        allButtons.Remove(int.Parse(btnPressed.Tag.ToString()));
                        collectionButtons[buttonsStack.Peek()].Remove(btnPressed);
                        panelGUI.Controls.Remove(btnPressed);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                }
            }
        }
 private void Awake()
 {
     fs = flightStick.GetComponent <FlightStick>();
     dragButtonTriggerZone = dragButton.transform.Find("TriggerZone").GetComponent <DragButton>();
 }
Пример #11
0
        //Mouse clicked inside GUI panel, create dragButton object
        private void MouseClicked(object sender, MouseEventArgs e)
        {
            if (ButtonControl.enableAdd)
            {
                int btnId;
                if (allButtons.Count != 0)
                {
                    btnId = allButtons.Keys.Max() > collectionButtons.Keys.Max() ? allButtons.Keys.Max() + 1 : collectionButtons.Keys.Max() + 1;
                }
                else
                {
                    btnId = collectionButtons.Keys.Max() + 1;
                }

                //Creating StorageCollection button
                if (cmbAddType.Text == "Storage collection")
                {
                    //Create collection button
                    DragButton dragButton = new DragButton(Enums.ButtonTypes.Collection);
                    dragButton.Text       = tBoxAddName.Text;
                    dragButton.Name       = "btnCollection_" + btnId.ToString();
                    dragButton.Tag        = btnId;
                    dragButton.Location   = new System.Drawing.Point(PointToClient(Cursor.Position).X, PointToClient(Cursor.Position).Y);
                    dragButton.MouseDown += collectionPressed; //When button is clicked

                    //Add button to panel [display it]
                    panelGUI.Controls.Add(dragButton);
                    dragButton.BringToFront();

                    //Add button to it's collection  [to all btns]
                    collectionButtons[buttonsStack.Peek()].Add(dragButton);

                    //Create this button collection [this collection]
                    collectionButtons.Add(btnId, new List <DragButton>());

                    //Add to all buttns [database]
                    try{ ButtonsClient.AddButtonToAllButtons(Mapper.mapDragButtonToTransferButton(dragButton)); }
                    catch (Exception) { MessageBox.Show("Failed to add to database"); }

                    //Add to all buttons [holder]
                    allButtons.Add(btnId, dragButton);

                    //Create new connnection
                    ButtonConnection connection = new ButtonConnection
                    {
                        ConnectionID       = ButtonConnectionHolder.connections.Count == 0 ? 0 : ButtonConnectionHolder.connections.Max(elem => elem.ConnectionID) + 1,
                        CollectionButtonId = buttonsStack.Peek(),
                        UnitButtonID       = btnId
                    };

                    //Add connection to database, so we know in which layer it is [database]
                    try
                    {
                        ButtonsClient.AddButtonConnection(connection);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Failed to add to database");
                    }


                    //Add connection to connection holder
                    ButtonConnectionHolder.connections.Add(connection);

                    //Push on stack [stack]
                    buttonsStack.Push(btnId);

                    panelGUI.Controls.Clear();

                    //make backbtn visible
                    btnBackFromChild.Visible = true;
                }
                else
                {
                    //Create Unit button
                    DragButton dragButton = new DragButton(Enums.ButtonTypes.Unit);
                    dragButton.Text       = tBoxAddName.Text;
                    dragButton.Name       = "btnUnit_" + btnId.ToString();
                    dragButton.Tag        = btnId;
                    dragButton.Location   = new System.Drawing.Point(PointToClient(Cursor.Position).X, PointToClient(Cursor.Position).Y);
                    dragButton.MouseDown += unitPressed; //When button is clicked

                    //Add button to panel [display it]
                    panelGUI.Controls.Add(dragButton);
                    dragButton.BringToFront();

                    //Add UnitButton to it's collectionButton [list]
                    collectionButtons[buttonsStack.Peek()].Add(dragButton);

                    //Add button to allButtons [list]
                    allButtons.Add(btnId, dragButton);

                    //Add button to database, all buttons table [database]
                    try
                    {
                        ButtonsClient.AddButtonToAllButtons(Mapper.mapDragButtonToTransferButton(dragButton));
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Failed to add to database");
                    }


                    //Create new connnection
                    ButtonConnection connection = new ButtonConnection
                    {
                        ConnectionID       = ButtonConnectionHolder.connections.Count == 0 ? 0 : ButtonConnectionHolder.connections.Max(elem => elem.ConnectionID) + 1,
                        CollectionButtonId = buttonsStack.Peek(),
                        UnitButtonID       = btnId
                    };

                    try
                    {
                        //Add connection to database, so we know in which layer it is [database]
                        ButtonsClient.AddButtonConnection(connection);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Failed to add to database");
                    }

                    //Add connection to connection holder [Holder]
                    ButtonConnectionHolder.connections.Add(connection);
                }


                //btn.Image = System.Drawing.Image.FromFile(@"C:\Users\Alen\Desktop\faks\0.ZAVRSNI\images\container.png");
                ButtonControl.enableAdd = false;
            }
        }
 void Start()
 {
     dragButton = GetComponent <DragButton> ();
     dragButton.dragUpEvents += HandleDragUpEvent;
 }
 private void Awake()
 {
     spacecraftFlightControls = spacecraft.GetComponent <SpacecraftFlightControls>();
     dragButtonComponent      = dragButton.transform.Find("TriggerZone").GetComponent <DragButton>();
 }