Exemplo n.º 1
0
    public void UpdateStatus(string statusMsg)
    {
        StatusText.GetComponent <Text>().text = statusMsg;
        Debug.Log(statusMsg);
        if (PeerType == 1)
        {
            CardListPanel.SetActive(true);
            PeerListPanel.SetActive(false);
            //      SendProfileBtn.SetActive(true);

            foreach (string card in cardList)
            {
                Debug.Log("card : " + card);
                GameObject button = (GameObject)Instantiate(CardPrefab);
                button.transform.SetParent(cardParent.transform);
                Debug.Log("Button Created");
                button.GetComponent <RawImage>().texture = imageTextures[cardList.IndexOf(card)];

                button.GetComponent <Button>().onClick.AddListener(() => CardClick(card));
            }
        }
        else
        {
            Image.SetActive(false);
            ConnectedImage.SetActive(true);
        }
        Debug.Log(statusMsg);
    }
Exemplo n.º 2
0
    private void CardClick(string card)
    {
        CardListPanel.SetActive(false);
        SelectedCard.SetActive(true);
        SendProfileBtn.SetActive(true);

        SelectedCard.GetComponent <RawImage>().texture = imageTextures[cardList.IndexOf(card)];
        cardToBeSentId = card;
    }
Exemplo n.º 3
0
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.COMMON_BACK:
            _cardListPanel.Hide();
            _panel.Show(0);
            break;

        case MessageConst.MODULE_RECOLLECTION_SHOW_CHOOSE_CARD:

            if (_cardListPanel == null)
            {
                _cardListPanel = new CardListPanel();
                _cardListPanel.Init(this);
                RegisterModel <DrawData>();
            }
            _cardListPanel.Show(0);

            break;

        case MessageConst.MODULE_RECOLLECTION_CARD_SELECTED:
            _cardListPanel?.Hide();
            _panel.Show(0);
            if (_cardDropPropWindow)
            {
                _cardDropPropWindow.Close();
            }
            break;

        case MessageConst.MODULE_RECOLLECTION_SHOW_CARD_DROP_PROP:
            _propId = (int)body[0];
            if (_model.OpenCardDict != null)
            {
                ShowCardDropProp(_propId);
            }
            else
            {
                NetWorkManager.Instance.Send <DrawProbRes>(CMD.DRAWC_DRAW_PROBS, null, OnGetOpenCardList, null, true);
            }
            break;
        }
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        authReference = Firebase.Auth.FirebaseAuth.DefaultInstance;
        authUser      = authReference.CurrentUser;
        if (authUser == null)
        {
            SceneManager.LoadScene("LoginScene");
        }
        FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://card-677f1.firebaseio.com/");

        databaseReference = FirebaseDatabase.DefaultInstance.RootReference;
        Query query = databaseReference.Child("cards").OrderByChild("user_id").EqualTo(authUser.UserId);

        query.GetValueAsync().ContinueWith(task => {
            if (task.IsFaulted)
            {
                print("ERROR");
                // Handle the error...
            }
            else if (task.IsCompleted)
            {
                DataSnapshot snapshot = task.Result;
                // Do something with snapshot...
                foreach (DataSnapshot childSnaphot in snapshot.Children)
                {
                    Debug.Log(childSnaphot.Key.ToString());

                    downloadUrl = childSnaphot.Child("target_url").Value.ToString();

                    downloadUrls.Add(downloadUrl);
                    cardList.Add(childSnaphot.Key.ToString());
                }

                StartCoroutine(DownloadCard());
            }
        });

        activityClass   = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        activityContext = activityClass.GetStatic <AndroidJavaObject>("currentActivity");
        contextClass    = new AndroidJavaClass("android.content.Context");
        context         = activityContext.Call <AndroidJavaObject>("getApplicationContext");

        PeerType = 0;

        if (!Permission.HasUserAuthorizedPermission(Permission.CoarseLocation))
        {
            Permission.RequestUserPermission(Permission.CoarseLocation);
            //Permission.RequestUserPermission(Permission.FineLocation);
        }

        PeerListPanel.SetActive(false);
        StatusText.SetActive(false);
        SendProfileBtn.SetActive(false);
        Image.SetActive(false);
        DoneImage.SetActive(false);
        DoneText.SetActive(false);
        ConnectedImage.SetActive(false);
        CardListPanel.SetActive(false);
        SelectedCard.SetActive(false);
        ViewProfileBtn.SetActive(false);

        //		WifiStatus.text = "Device Ready";
        Debug.Log("Device Ready");
    }