Ejemplo n.º 1
0
    private void ServerMessageReceiver(NetworkMessage NetMsg)
    {
        StringMessage msg = new StringMessage();

        msg.value   = NetMsg.ReadMessage <StringMessage>().value;
        textUI.text = msg.value;
        string[] deltas = msg.value.Split('|');
        switch (deltas[0])
        {
        case "Player":
            int ToSetID;
            if (Int32.TryParse(deltas[1], out ToSetID))
            {
                PlayerID = ToSetID;
                PlayersImages[PlayerID - 1].SetActive(true);
                ConnectButton.SetActive(false);
            }
            break;

        case "Start":
            Scene1UI.SetActive(true);
            PlayersImages[PlayerID - 1].SetActive(false);
            break;

        case "Scene1":
            Scene1UI.SetActive(true);
            Scene2UI.SetActive(false);
            break;

        case "Scene2":
            Scene1UI.SetActive(false);
            Scene2UI.SetActive(true);
            break;

        default:
            Debug.Log("Message");
            break;
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化结点的插槽
        /// </summary>
        /// <param name="Size">当前图元的大小</param>
        protected override void InitSlot(Size size)
        {
            int x1 = location.X + (int)(size.Width / 2) - 3;
            int y1 = location.Y - 3;
            int x2 = x1;
            int y2 = location.Y + size.Height;
            int x3 = location.X + size.Width - 3;
            int y3 = location.Y + (int)((size.Height - 20) / 2) - 3 + 20;

            SlotGraphElement slot1 = new SlotGraphElement(this, new Point(x1, y1), new Size(6, 6));
            SlotGraphElement slot2 = new SlotGraphElement(this, new Point(x2, y2), new Size(6, 6));
            SlotGraphElement slot3 = new SlotGraphElement(this, new Point(x3, y3), new Size(6, 6));

            slot1.Name = "连接插槽";
            slot1.FrameColor = Color.RoyalBlue;
            slot1.SelectedColor = Color.Red;
            slot1.ActivatedColor = Color.DarkOrange;
            slot1.BindedColor = Color.Lime;
            slot1.IsInSlot = true;
            slot1.IsOutSlot = false;
            slot1.IsJumpSlot = false;
            slot1.CanDelete = true;
            slot2.Name = "连接插槽";
            slot2.FrameColor = Color.RoyalBlue;
            slot2.SelectedColor = Color.Red;
            slot2.ActivatedColor = Color.DarkOrange;
            slot2.BindedColor = Color.Lime;
            slot2.IsInSlot = false;
            slot2.IsOutSlot = true;
            slot2.IsJumpSlot = false;
            slot2.CanDelete = true;
            slot3.Name = "连接插槽";
            slot3.FrameColor = Color.RoyalBlue;
            slot3.SelectedColor = Color.Red;
            slot3.ActivatedColor = Color.DarkOrange;
            slot3.BindedColor = Color.Lime;
            slot3.IsInSlot = false;
            slot3.IsOutSlot = false;
            slot3.IsJumpSlot = true;
            slot3.CanDelete = false;

            ConnectButton button = new ConnectButton(slot2, new Point(x2 - 6, y2 + 5), new Size(12, 18));
            button.Name = "连接按钮";
            button.NormalImage = connectButtonNormalImage;
            button.SelectedImage = connectButtonSelectedImage;
            button.ActivatedImage = connectButtonActivatedImage;
            slot2.BindingConnectButton = button;

            ConnectJumpButton jumpButton = new ConnectJumpButton(slot3, new Point(x3 + 5, y3 - 6), new Size(18, 12));
            jumpButton.Name = "连接按钮";
            jumpButton.NormalImage = connectJumpButtonNormalImage;
            jumpButton.SelectedImage = connectJumpButtonSelectedImage;
            jumpButton.ActivatedImage = connectJumpButtonActivatedImage;
            slot3.BindingConnectButton = jumpButton;

            inSlotList.Add(slot1);
            outSlotList.Add(slot2);
            jumpSlotList.Add(slot3);
            buttonList.Add(button);
            buttonList.Add(jumpButton);
            slotList.Add(slot1);
            slotList.Add(slot2);
            slotList.Add(slot3);
        }