Example #1
0
    // Update is called once per frame
    void Update()
    {
        //if (!initialized && WaitingTime < 0)
        //{
        //    initialized = true;
        //    Initialize();
        //}
        //else
        //{
        //    WaitingTime -= Time.deltaTime;
        //}

        if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1))
        {
            Slot1.GetPanel().DoClick();
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2))
        {
            Slot2.GetPanel().DoClick();
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3))
        {
            Slot3.GetPanel().DoClick();
        }
        else if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4))
        {
            Slot4.GetPanel().DoClick();
        }

        if (logger != null)
        {
            logger.UpdateTime(Time.deltaTime);
        }
    }
Example #2
0
    void PerformSlotClick(int slot, dfPanel panel)
    {
        if (MyRobot != null)
        {
            activePanel.DeactivatePanel();
            MyRobot.SwitchBrain(slot);

            switch (slot)
            {
            case 1:
                activePanel = Slot1.GetComponent <BrainPanelState>();
                break;

            case 2:
                activePanel = Slot2.GetComponent <BrainPanelState>();
                break;

            case 3:
                activePanel = Slot3.GetComponent <BrainPanelState>();
                break;

            case 4:
                activePanel = Slot4.GetComponent <BrainPanelState>();
                break;
            }
            activePanel.ActivatePanel();
        }
    }
        public void Spin()
        {
            Spins = 0;
            var t = 1000;

            Slot0.Spin(t);
            Slot1.Spin(t * 2);
            Slot2.Spin(t * 3);
            SoundPlayer.Instance.Play(SoundTrack.Get("sfx_slot" + RNG.Next(0, 3)));
        }
Example #4
0
 public InventoryManager()
 {
     Slot1          = new Slot1(CommonEnums.Interactables.None);
     Slot2          = new Slot2(CommonEnums.Interactables.None);
     Slot3          = new Slot3(CommonEnums.Interactables.None);
     InventorySlots = new Dictionary <CommonEnums.InventorySlot, CommonEnums.Interactables>();
     InventorySlots.Add(CommonEnums.InventorySlot.Slot1, Slot1.Contains);
     InventorySlots.Add(CommonEnums.InventorySlot.Slot2, Slot2.Contains);
     InventorySlots.Add(CommonEnums.InventorySlot.Slot3, Slot3.Contains);
 }
 void LobbyButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     if (Slot1.GetComponent <BrainPanelState>().InUse || Slot2.GetComponent <BrainPanelState>().InUse ||
         Slot3.GetComponent <BrainPanelState>().InUse || Slot4.GetComponent <BrainPanelState>().InUse)
     {
         Application.LoadLevel("Lobby scene");
     }
     else
     {
         _dialog.ShowDialog("You must select at least one brain to use in battle before you can start fighting!" +
                            "\n\nTo select a brain, simply drag it down to an empty slot in the 'Selected brains' panel.");
     }
 }
Example #6
0
        public override void Write(ref NetworkStream netstream)
        {
            using (Stream stream = new MemoryStream())
            {
                // write id
                stream.Write(BitConverter.GetBytes((ushort)this.ID), 0, 2);

                // write temporary size
                stream.Write(BitConverter.GetBytes(0), 0, 4);

                // write pctypes
                stream.WriteByte((byte)_pctypes[0]);
                stream.WriteByte((byte)_pctypes[1]);
                stream.WriteByte((byte)_pctypes[2]);

                // store header size
                int headersize = (int)stream.Position;

                // write slots
                if (Slot1 != null)
                {
                    Slot1.Write(stream);
                }

                if (Slot2 != null)
                {
                    Slot2.Write(stream);
                }

                if (Slot3 != null)
                {
                    Slot3.Write(stream);
                }

                byte[] result = new byte[stream.Length];

                // go back and write body size
                this.BodySize = (uint)(stream.Length - headersize);

                stream.Position = 2;
                stream.Write(BitConverter.GetBytes(this.BodySize), 0, 4);

                // write memorystream to networkstream
                stream.Position = 0;
                stream.CopyTo(netstream);
            }
        }
Example #7
0
        public override void SetActualSize(Point available)
        {
            if (!Visible)
            {
                SetDimension(Point.Zero, available);
                return;
            }

            Point minSize = GetExpectedSize(available);

            SetDimension(minSize, available);

            Rectangle client = ActualClientArea;

            if (Orientation == Orientation.Horizontal)
            {
                // Trennung zwischen links und rechts
                if (Slot1 != null)
                {
                    Slot1.SetActualSize(new Point(ActualSplitterPosition, client.Height));
                }
                if (Slot2 != null)
                {
                    Slot2.SetActualSize(new Point(client.Width - SplitterSize - ActualSplitterPosition, client.Height));
                    Slot2.ActualPosition += new Point(ActualSplitterPosition + SplitterSize, 0);
                }
            }
            else if (Orientation == Orientation.Vertical)
            {
                // Trennung zwischen oben und unten
                if (Slot1 != null)
                {
                    Slot1.SetActualSize(new Point(client.Width, ActualSplitterPosition));
                }
                if (Slot2 != null)
                {
                    Slot2.SetActualSize(new Point(client.Width, client.Height - SplitterSize - ActualSplitterPosition));
                    Slot2.ActualPosition += new Point(0, ActualSplitterPosition + SplitterSize);
                }
            }
        }
 private void Slot_FinishedSpin(object sender, EventArgs e)
 {
     Spins++;
     if (Spins == 3)
     {
         Int32  dice;
         Entity prize = null;
         var    res0  = Slot0.GetResult();
         var    res1  = Slot1.GetResult();
         var    res2  = Slot2.GetResult();
         dice = RNG.Next(100);
         if (res0 == res1 && res0 == res2)
         {
             if (dice < 65)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.VeryRare).Random();
             }
             else if (dice < 80)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Epic).Random();
             }
             else if (dice <= 95)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Legendary).Random();
             }
         }
         else if (res0 == res1 || res1 == res2 || res0 == res2)
         {
             if (dice < 30)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Uncommon).Random();
             }
             else if (dice < 60)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Rare).Random();
             }
             else if (dice < 90)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.VeryRare).Random();
             }
             else if (dice <= 100)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Epic).Random();
             }
         }
         else
         {
             if (dice < 50)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Common).Random();
             }
             else if (dice < 70)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Uncommon).Random();
             }
             else if (dice < 95)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Rare).Random();
             }
             else if (dice < 99)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.VeryRare).Random();
             }
             else if (dice <= 100)
             {
                 prize = Entity.GetAll().Where(x => x.Rarity == Rarity.Epic).Random();
             }
         }
         var prizeSticker = new Sticker(prize, overrideValidation: true);
         prizeSticker.Width  = 150;
         prizeSticker.Height = 225;
         LastPrizePanel.Children.Clear();
         LastPrizePanel.Children.Add(prizeSticker);
         GameMaster.Player.Inventory.Add(new SimpleSticker()
         {
             ItemID = prize.ID
         });
         DebugUtils.Log($"Minigame prize => <{prize.ID}> => {prize.Rarity}!");
         SoundPlayer.Instance.Play(SoundTrack.Get("sfx_coins"));
         IsSpinning = false;
     }
 }
        void Update()
        {
            Value1 = Slot1.GetComponent <SnapDropZoneOverride>().thisStack.Count;
            Value2 = Slot2.GetComponent <SnapDropZoneOverride>().thisStack.Count;
            Value3 = Slot3.GetComponent <SnapDropZoneOverride>().thisStack.Count;

            if (Value1 > 0)
            {
                //Rather than using '4' to show the maximum amount, we use 'M' or 'MAX' to indicate that the player that you can no longer put anymore utensils inside.
                if (Value1 == 4)
                {
                    counter.gameObject.SetActive(true);

                    //Rather than setting it to the current value, if the value is 4, the value will be set to 'M'.
                    counter.text = "M";
                }
                else
                {
                    counter.gameObject.SetActive(true);

                    //Else, any value than 4, will display its current number.
                    counter.text = Value1.ToString();
                }
            }
            else
            {
                counter.gameObject.SetActive(false);
            }

            if (Value2 > 0)
            {
                //Rather than using '4' to show the maximum amount, we use 'M' or 'MAX' to indicate that the player that you can no longer put anymore utensils inside.
                if (Value2 == 4)
                {
                    counter2.gameObject.SetActive(true);

                    //Rather than setting it to the current value, if the value is 4, the value will be set to 'M'.
                    counter2.text = "M";
                }
                else
                {
                    counter2.gameObject.SetActive(true);

                    //Else, any value than 4, will display its current number.
                    counter2.text = Value2.ToString();
                }
            }
            else
            {
                counter2.gameObject.SetActive(false);
            }

            if (Value3 > 0)
            {
                //Rather than using '4' to show the maximum amount, we use 'M' or 'MAX' to indicate that the player that you can no longer put anymore utensils inside.
                if (Value3 == 4)
                {
                    counter3.gameObject.SetActive(true);

                    //Rather than setting it to the current value, if the value is 4, the value will be set to 'M'.
                    counter3.text = "M";
                }
                else
                {
                    counter3.gameObject.SetActive(true);

                    //Else, any value than 4, will display its current number.
                    counter3.text = Value3.ToString();
                }
            }
            else
            {
                counter3.gameObject.SetActive(false);
            }
        }
Example #10
0
    void Initialize()
    {
        // Camera.main.GetComponent<MousePan>().Activated = true;
        Slot1.ActivatePanel();
        activePanel = Slot1;

        if (Slot1.InUse)
        {
            Slot1.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 1));
        }
        if (Slot2.InUse)
        {
            Slot2.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 2));
        }
        if (Slot3.InUse)
        {
            Slot3.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 3));
        }
        if (Slot4.InUse)
        {
            Slot4.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 4));
        }

        IBlackBox brain1 = null, brain2 = null, brain3 = null, brain4 = null, activeBrain = null;
        string    path = "";

        if (Player.Brain1 != null)
        {
            path = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain1.ObjectId);
            // print("Path: " + path);
            brain1      = Utility.LoadBrain(path);
            activeBrain = brain1;
        }
        if (Player.Brain2 != null)
        {
            path   = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain2.ObjectId);
            brain2 = Utility.LoadBrain(path);
            if (activeBrain == null)
            {
                activeBrain = brain2;
            }
        }

        if (Player.Brain3 != null)
        {
            path   = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain3.ObjectId);
            brain3 = Utility.LoadBrain(path);
            if (activeBrain == null)
            {
                activeBrain = brain3;
            }
        }

        if (Player.Brain4 != null)
        {
            path   = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain4.ObjectId);
            brain4 = Utility.LoadBrain(path);
            if (activeBrain == null)
            {
                activeBrain = brain4;
            }
        }


        Controller.Activate(activeBrain, Target);
        Controller.SetBrains(brain1, brain2, brain3, brain4);

        // print("Current mission: " + PlayerPrefs.GetInt(MissionPanel.CURRENT_MISSION, 1));
        string arena = "";

        switch (PlayerPrefs.GetInt(MissionPanel.CURRENT_MISSION, 1))
        {
        case 1:
            arena = "Mission 1";

            Mission1.Initialize(this);
            break;

        case 2:
            arena = "Mission 2";
            Mission2.Initialize(this);
            break;

        case 3:
            arena = "Mission 3";
            Mission3.Initialize(this);
            break;

        case 4:
            arena = "Mission 4";
            Mission4.Initialize(this);
            break;

        case 5:
            arena = "Mission 5";
            Mission5.Initialize(this);
            break;
        }
        logger = new EventLogger(Controller, arena);

        logger.StartLogging();
    }
Example #11
0
 public void SetSlot(string Slot)
 {
     if (Slot == "wood")
     {
         if (CheckWood() == 0)
         {
             if (CheckSlot() == 1)
             {
                 Slot1.GetComponent <RawImage>().texture = wood;
                 Text1.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 2)
             {
                 Slot2.GetComponent <RawImage>().texture = wood;
                 Text2.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 3)
             {
                 Slot3.GetComponent <RawImage>().texture = wood;
                 Text3.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 4)
             {
                 Slot4.GetComponent <RawImage>().texture = wood;
                 Text4.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 5)
             {
                 Slot5.GetComponent <RawImage>().texture = wood;
                 Text5.text = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 6)
             {
                 Slot6.GetComponent <RawImage>().texture = wood;
                 Text6.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 7)
             {
                 Slot7.GetComponent <RawImage>().texture = wood;
                 Text7.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 8)
             {
                 Slot8.GetComponent <RawImage>().texture = wood;
                 Text8.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 9)
             {
                 Slot9.GetComponent <RawImage>().texture = wood;
                 Text9.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 10)
             {
                 Slot10.GetComponent <RawImage>().texture = wood;
                 Text10.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 11)
             {
                 Slot11.GetComponent <RawImage>().texture = wood;
                 Text11.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 12)
             {
                 Slot12.GetComponent <RawImage>().texture = wood;
                 Text12.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 13)
             {
                 Slot13.GetComponent <RawImage>().texture = wood;
                 Text13.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 14)
             {
                 Slot14.GetComponent <RawImage>().texture = wood;
                 Text14.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
             else if (CheckSlot() == 15)
             {
                 Slot15.GetComponent <RawImage>().texture = wood;
                 Text15.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().wood;
             }
         }
         else if (CheckWood() == 1)
         {
             Text1.text = ("" + Player.GetComponent <PlayerSatatus>().wood);
         }
         else if (CheckWood() == 2)
         {
             Text2.text = ("" + Player.GetComponent <PlayerSatatus>().wood);
         }
     }
     else if (Slot == "stone")
     {
         if (CheckStone() == 0)
         {
             if (CheckSlot() == 1)
             {
                 Slot1.GetComponent <RawImage>().texture = stone;
                 Text1.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 2)
             {
                 Slot2.GetComponent <RawImage>().texture = stone;
                 Text2.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 3)
             {
                 Slot3.GetComponent <RawImage>().texture = stone;
                 Text3.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 4)
             {
                 Slot4.GetComponent <RawImage>().texture = stone;
                 Text4.text = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 5)
             {
                 Slot5.GetComponent <RawImage>().texture = stone;
                 Text5.text = ("" + Player.GetComponent <PlayerSatatus>().stone);
             }
             else if (CheckSlot() == 6)
             {
                 Slot6.GetComponent <RawImage>().texture = stone;
                 Text6.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 7)
             {
                 Slot7.GetComponent <RawImage>().texture = stone;
                 Text7.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 8)
             {
                 Slot8.GetComponent <RawImage>().texture = stone;
                 Text8.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 9)
             {
                 Slot9.GetComponent <RawImage>().texture = stone;
                 Text9.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 10)
             {
                 Slot10.GetComponent <RawImage>().texture = stone;
                 Text10.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 11)
             {
                 Slot11.GetComponent <RawImage>().texture = stone;
                 Text11.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 12)
             {
                 Slot12.GetComponent <RawImage>().texture = stone;
                 Text12.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 13)
             {
                 Slot13.GetComponent <RawImage>().texture = stone;
                 Text13.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 14)
             {
                 Slot14.GetComponent <RawImage>().texture = stone;
                 Text14.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
             else if (CheckSlot() == 15)
             {
                 Slot15.GetComponent <RawImage>().texture = stone;
                 Text15.GetComponent <Text>().text        = "" + Player.GetComponent <PlayerSatatus>().stone;
             }
         }
         else if (CheckStone() == 1)
         {
             Text1.text = ("" + Player.GetComponent <PlayerSatatus>().stone);
         }
         else if (CheckStone() == 2)
         {
             Text2.text = ("" + Player.GetComponent <PlayerSatatus>().stone);
         }
     }
 }
Example #12
0
 int CheckStone()
 {
     if (Slot1.GetComponent <RawImage>().texture == stone)
     {
         return(1);
     }
     else if (Slot2.GetComponent <RawImage>().texture == stone)
     {
         return(2);
     }
     else if (Slot3.GetComponent <RawImage>().texture == stone)
     {
         return(3);
     }
     else if (Slot4.GetComponent <RawImage>().texture == stone)
     {
         return(4);
     }
     else if (Slot5.GetComponent <RawImage>().texture == stone)
     {
         return(5);
     }
     else if (Slot6.GetComponent <RawImage>().texture == stone)
     {
         return(6);
     }
     else if (Slot7.GetComponent <RawImage>().texture == stone)
     {
         return(7);
     }
     else if (Slot8.GetComponent <RawImage>().texture == stone)
     {
         return(8);
     }
     else if (Slot9.GetComponent <RawImage>().texture == stone)
     {
         return(9);
     }
     else if (Slot10.GetComponent <RawImage>().texture == stone)
     {
         return(10);
     }
     else if (Slot11.GetComponent <RawImage>().texture == stone)
     {
         return(11);
     }
     else if (Slot12.GetComponent <RawImage>().texture == stone)
     {
         return(12);
     }
     else if (Slot13.GetComponent <RawImage>().texture == stone)
     {
         return(13);
     }
     else if (Slot14.GetComponent <RawImage>().texture == stone)
     {
         return(14);
     }
     else if (Slot15.GetComponent <RawImage>().texture == stone)
     {
         return(15);
     }
     else
     {
         return(0);
     }
 }