예제 #1
0
 public override void Run(DeckHandler dh)
 {
     if (!String.IsNullOrEmpty(ProgramPath))
     {
         System.Diagnostics.Process.Start(ProgramPath);
     }
 }
예제 #2
0
    public override void OnInspectorGUI()
    {
        DeckHandler myTarget = (DeckHandler)target;

        EditorUtility.SetDirty(myTarget);

        myTarget.emptyCardPrefab = EditorGUILayout.ObjectField("EmptyCard:", myTarget.emptyCardPrefab, typeof(GameObject), false) as GameObject;
        myTarget.deckList        = EditorGUILayout.ObjectField("Deck List:", myTarget.deckList, typeof(DeckList), false) as DeckList;

        if (!EditorApplication.isPlaying)
        {
            return;
        }

        Queue <InSceneCard> cards = myTarget.getCards();
        int x = 0;

        foreach (var item in cards)
        {
            EditorGUILayout.LabelField("Slot#" + x++, item.cardInfo.name);
        }

        if (GUILayout.Button("ValidateCards"))
        {
            myTarget.validate();
        }
        if (GUILayout.Button("Shuffle"))
        {
            myTarget.shuffleDeck();
        }
    }
예제 #3
0
 private void Start()
 {
     PhotonNetwork.ConnectUsingSettings("1.0");
     DeckHandler.LoadFromSaveToDeck();
     _audioControl = GameObject.FindGameObjectWithTag(Tag.Audio).GetComponent <AudioControl>();
     ButtonCheck();
 }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        //defaults the hand to be untoggled
        showingHand      = false;
        pos              = transform.position;
        handSpriteRender = gameObject.GetComponent <SpriteRenderer>();
        //resize the sprite[] to 40, to hold all card sprites
        Array.Resize(ref cardSprites, 50);
        Resources.LoadAll <Sprite>("Assets/Cards").CopyTo(cardSprites, 0);
        //initializes array and used scripts
        spriteArray = this.GetComponent <SpriteArray>();
        deckHandler = playerDeck.GetComponent <DeckHandler>();
        cardData    = cards.GetComponent <CardData>();
        //initializes and tells the button "place" what to do
        Button placeCard = place.GetComponent <Button>();

        placeCard.onClick.AddListener(PlaceCards);
        //initializes the card places and attack text
        card1Sprite = card1.GetComponent <SpriteRenderer>();
        card2Sprite = card2.GetComponent <SpriteRenderer>();
        card3Sprite = card3.GetComponent <SpriteRenderer>();
        atkTxtMsh1  = atkTxt1.GetComponent <TextMesh>();
        atkTxtMsh2  = atkTxt2.GetComponent <TextMesh>();
        atkTxtMsh3  = atkTxt3.GetComponent <TextMesh>();
        hlthTxtMsh1 = hlthTxt1.GetComponent <TextMesh>();
        hlthTxtMsh2 = hlthTxt2.GetComponent <TextMesh>();
        hlthTxtMsh3 = hlthTxt3.GetComponent <TextMesh>();
    }
예제 #5
0
 public FolderNavigate(DeckHandler dh) : base(dh)
 {
     base.isNavigationKey = true;
     PageReference        = new Page("New Page");
     PageReference.Keys[4].setImage("Resources\\back.png");
     PageReference.Keys[4].KeyPressedFunction = new GoBack(dh);
     PageReference.Keys[4].KeyHeldFunction    = new GoHome(dh);
 }
예제 #6
0
    void Awake()
    {
        states           = GetComponent <StateManager>() ?? gameObject.AddComponent <StateManager>();
        deckHandler      = GetComponent <DeckHandler>() ?? gameObject.AddComponent <DeckHandler>();
        animationManager = GetComponent <AnimationManager>() ?? gameObject.AddComponent <AnimationManager>();

        instance = this;
    }
예제 #7
0
    void Setup()
    {
        GameObject[] playerObject = GameObject.FindGameObjectsWithTag("Player");
        allPlayer = new GameObject[playerObject.Length];
        for (int i = 0; i < playerObject.Length; i++)
        {
            allPlayer[i] = playerObject[i];
        }

        deckHandler = GameManager.Instance.deckHandler;
    }
예제 #8
0
 public override void Run(DeckHandler dh)
 {
     if (!String.IsNullOrEmpty(WebUrl) && IsValidUri(WebUrl))
     {
         System.Diagnostics.Process.Start(WebUrl);
     }
     else
     {
         MessageBox.Show(String.Format("Couldn't load that link. It may not be valid. ({0})", WebUrl));
     }
 }
예제 #9
0
 public override void Run(DeckHandler dh)
 {
     if (dh.PageStack.Count > 0)
     {
         dh.CurrentPage = dh.PageStack.Pop();
         dh.renderPage();
     }
     else
     {
         MessageBox.Show("No page to go back to");
     }
 }
예제 #10
0
        static void Main()
        {
            DeckHandler deckHandler = new DeckHandler();

            //TODO: Manage streamdeck not being connected and manage searching for the connection periodically when one isn't detected
            if (deckHandler.Deck == null)
            {
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainPage(deckHandler));
        }
예제 #11
0
 public TwitchSubscriptions(DeckHandler dh = null) : base(dh)
 {
     base.isNavigationKey = true;
     updateLive           = new Thread(() =>
     {
         CacheTimer          = new System.Windows.Forms.Timer();
         CacheTimer.Interval = 60000;
         CacheTimer.Tick    += updateLiveChannels;
         CacheTimer.Start();
         updateLiveChannels(null, null);
     });
     updateLive.Start();
 }
예제 #12
0
    private void Start()
    {
        deckHandler    = GameManager.Instance.deckHandler;
        uiHandler      = GameManager.Instance.uiHandler;
        cardSetHandler = GameManager.Instance.cardSetHandler;

        firstLineSet  = new List <Card>();
        secondLineSet = new List <Card>();
        thirdLineSet  = new List <Card>();

        screenForSetup.SetActive(false);
        uiHandler.canvasSetup.gameObject.SetActive(false);
        uiHandler.completeBtn().onClick.AddListener(SetupComplete);
    }
예제 #13
0
        public override void Run(DeckHandler dh)
        {
            Page PageReference = new Page("Twitch Live Subs");

            PageReference.Keys[4].setImage("Resources\\back.png");
            PageReference.Keys[4].KeyPressedFunction = new GoBack(dh);
            PageReference.Keys[4].KeyHeldFunction    = new GoHome(dh);

            //Wait for liveChannels to be populated
            while (liveChannels == null)
            {
                Thread.Sleep(1);
            }

            var i = 0;

            foreach (var stream in liveChannels.Streams)
            {
                string saveLocation = "image_cache\\" + stream.Channel.DisplayName + ".jpeg";
                if (!File.Exists(saveLocation))
                {
                    var logoUrl = stream.Channel.Logo.Replace("300x300", "70x70");
                    Console.WriteLine(logoUrl);
                    WebClient    wc    = new WebClient();
                    byte[]       bytes = wc.DownloadData(logoUrl);
                    MemoryStream ms    = new MemoryStream(bytes);
                    Image        img   = Image.FromStream(ms);
                    img = ResizeImage(img, 72, 72);
                    if (!Directory.Exists("image_cache\\"))
                    {
                        Directory.CreateDirectory("image_cache\\");
                    }
                    img.Save(saveLocation, System.Drawing.Imaging.ImageFormat.Jpeg);
                }
                PageReference.Keys[i].setImage(saveLocation);
                PageReference.Keys[i].KeyPressedFunction = new OpenWebLink(stream.Channel.Url);
                i++;
                if (i == 4)
                {
                    i++;
                }
            }

            dh.PageStack.Push(dh.CurrentPage);
            dh.CurrentPage = PageReference;
            dh.renderPage();
        }
예제 #14
0
    public void OnClick()
    {
        StartGameView();
        GameObject  faceDownPile = GameObject.Find("faceDownPile");
        DeckHandler deckHandler  = faceDownPile.GetComponent <DeckHandler>();

        if (isServer)
        {
            deckHandler.PrepareDeck();
        }


        NetworkIdentity networkIdentity = NetworkClient.connection.identity;

        playerManager = networkIdentity.GetComponent <PlayerManager>();
        //playerManager.CmdDealHand();
    }
예제 #15
0
    public void Awake()
    {
        //turnHandler.playerCount += 1;
        //playerNumber = turnHandler.playerCount;
        //gameObject.name = $"Player {playerNumber}";


        playerHandArea = GameObject.Find("playerHandArea");
        faceDownPile   = GameObject.Find("faceDownPile");
        discardPile    = GameObject.Find("discardPile");
        goDownArea     = GameObject.Find("goDownArea");
        mainCanvas     = GameObject.Find("Game Panel");
        deckHandler    = faceDownPile.GetComponent <DeckHandler>();
        cardDeck       = deckHandler.cardDeck;



        //deckHandler.AssignAuthority(connectionToClient, cardList);
    }
예제 #16
0
    //deck starts with 3 copies of each card
    private void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        for (int i = 0; i < 6; i++)
        {
            deck.Add(3);
        }

        player1 = GameSystem.instance.player1;
        player2 = GameSystem.instance.player2;
    }
예제 #17
0
 public override void Run(DeckHandler dh)
 {
     dh.PageStack.Push(dh.CurrentPage);
     dh.CurrentPage = PageReference;
     dh.renderPage();
 }
예제 #18
0
 private void Awake()
 {
     Instance = this;
 }
예제 #19
0
 // start is called once at the start of the script
 private void Start()
 {
     cardData    = cards.GetComponent <CardData>();
     handHandler = cardInHand.GetComponent <HandHandler>();
     deckHandler = playerDeck.GetComponent <DeckHandler>();
 }
예제 #20
0
 public override void Run(DeckHandler dh)
 {
     return;
 }
예제 #21
0
 public OpenWebLink(DeckHandler dh)
 {
     WebUrl = "";
 }
예제 #22
0
 public OpenProgram(DeckHandler dh) : base(dh)
 {
 }
예제 #23
0
 public void Delete()
 {
     DeckHandler.DeleteCard(this);
 }
예제 #24
0
 public GoHome(DeckHandler dh) : base(dh)
 {
     base.isNavigationKey = true;
 }
예제 #25
0
 public NoFunction(DeckHandler dh = null) : base(dh)
 {
 }
예제 #26
0
 public KeyFunction(DeckHandler dh)
 {
 }
예제 #27
0
 public virtual void Run(DeckHandler dh)
 {
     //override this to implement your function
     return;
 }
예제 #28
0
 public override void Run(DeckHandler dh)
 {
     dh.CurrentPage = dh.CurrentProfile.MainPage;
     dh.renderPage();
 }
예제 #29
0
        public MainPage(DeckHandler dh)
        {
            InitializeComponent();

            deckHandler = dh;
            currentPage = new Page(deckHandler.CurrentPage);

            functionTypes = Assembly
                            .GetAssembly(typeof(KeyFunction))
                            .GetTypes()
                            .Where(t => t.IsSubclassOf(typeof(KeyFunction))).ToList <Type>();


            functionNames = new List <string>();
            foreach (var functionType in functionTypes)
            {
                var function = (KeyFunction)Activator.CreateInstance(functionType);
                functionNames.Add(function.getFunctionName());
            }

            //Generate tray icon
            systrayIcon = new NotifyIcon();
            systrayIcon.BalloonTipTitle = "OpenStreamDeck";
            systrayIcon.BalloonTipText  = "Double click to open OpenStreamDeck profile manager";
            systrayIcon.ShowBalloonTip(500);
            systrayIcon.DoubleClick += systrayIcon_DoubleClicked;

            var menu     = new ContextMenu();
            var menuItem = new MenuItem();

            menuItem.Index  = 0;
            menuItem.Text   = "Exit";
            menuItem.Click += exitButton_Clicked;
            menu.MenuItems.Add(menuItem);
            systrayIcon.ContextMenu = menu;
            systrayIcon.Icon        = new Icon("Resources/appicon.ico");
            systrayIcon.Visible     = true;

            //Build array of picture boxes. Indexes matching indexes for their respective keys.
            keyPictureBoxes = new List <PictureBox>();
            keyPictureBoxes.Add(keyZeroPicBox);
            keyPictureBoxes.Add(keyOnePicBox);
            keyPictureBoxes.Add(keyTwoPicBox);
            keyPictureBoxes.Add(keyThreePicBox);
            keyPictureBoxes.Add(keyFourPicBox);
            keyPictureBoxes.Add(keyFivePicBox);
            keyPictureBoxes.Add(keySixPicBox);
            keyPictureBoxes.Add(keySevenPicBox);
            keyPictureBoxes.Add(keyEightPicBox);
            keyPictureBoxes.Add(keyNinePicBox);
            keyPictureBoxes.Add(keyTenPicBox);
            keyPictureBoxes.Add(keyElevenPicBox);
            keyPictureBoxes.Add(keyTwelvePicBox);
            keyPictureBoxes.Add(keyThirteenPicBox);
            keyPictureBoxes.Add(keyFourteenPicBox);

            populateFields();

            //Initialize timer to check when UI needs refreshed for page changes
            UIRefreshCheck          = new Timer();
            UIRefreshCheck.Tick    += checkUpdate;
            UIRefreshCheck.Interval = 10;
            UIRefreshCheck.Start();
        }