Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.06 KB | None | 0 0
  1. using PlayFab;
  2. using PlayFab.ClientModels;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8.  
  9. public class DaileyManagment : MonoBehaviour
  10. {
  11.     [SerializeField] private int year, month, day, hours, minutes, seconds;
  12.  
  13.    
  14.    
  15.  
  16.    
  17.    
  18.  
  19.  
  20.     public GameObject DaileyEncounter;
  21.  
  22.     public GameObject Dayprice1;
  23.     public GameObject Dayprice2;
  24.     public GameObject Dayprice3;
  25.     public GameObject Dayprice4;
  26.     public GameObject Dayprice5;
  27.     public GameObject Dayprice6;
  28.     public GameObject Dayprice7;
  29.  
  30.     //public float Timer;
  31.  
  32.     public Text Clock;
  33.     public Text Dailey;
  34.     public Text Day1;
  35.     public Text Day2;
  36.     public Text Day3;
  37.     public Text Day4;
  38.     public Text Day5;
  39.     public Text Day6;
  40.     public Text Day7;
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.     void Awake()
  50.     {
  51.         GetStats();  
  52.     }
  53.  
  54.    
  55.  
  56.     // Start is called before the first frame update
  57.     void Start()
  58.     {
  59.        
  60.         Dailey.text = "Tägliche Belohnung füs einloggen";
  61.         Day1.text = "Tag 1";
  62.         Day2.text = "Tag 2";
  63.         Day3.text = "Tag 3";
  64.         Day4.text = "Tag 4";
  65.         Day5.text = "Tag 5";
  66.         Day6.text = "Tag 6";
  67.         Day7.text = "Tag 7";
  68.         //GetStats();
  69.     }
  70.  
  71.     // Update is called once per frame
  72.     void Update()
  73.     {
  74.  
  75.        
  76.        
  77.  
  78.         DateTime time = DateTime.Now;
  79.  
  80.         Clock.text = time.ToString("HH:mm:ss");
  81.  
  82.  
  83.         //DateTime myPrice = new DateTime (DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day, hours, minutes, seconds);
  84.  
  85.         if (DateTime.Now.Hour == hours && DateTime.Now.Minute == minutes && DateTime.Now.Second == seconds )
  86.         {
  87.             Dayprice1.SetActive(false);
  88.             print("deaktivert");
  89.         }
  90.        
  91.     }
  92.  
  93.  
  94.  
  95.     public void DaileyClosed()
  96.     {
  97.         DaileyEncounter.SetActive(false);
  98.     }
  99.  
  100.  
  101.  
  102.     public void DayPrice1()
  103.     {
  104.  
  105.     }
  106.  
  107.     public void DayPrice2()
  108.     {
  109.  
  110.     }
  111.  
  112.     public void DayPrice3()
  113.     {
  114.  
  115.     }
  116.  
  117.     public void DayPrice4()
  118.     {
  119.  
  120.     }
  121.  
  122.     public void DayPrice5()
  123.     {
  124.  
  125.     }
  126.  
  127.     public void DayPrice6()
  128.     {
  129.  
  130.     }
  131.  
  132.     public void DayPrice7()
  133.     {
  134.  
  135.     }
  136.  
  137.     public void GetStats()
  138.     {
  139.         //Neue Anfrage erstallen
  140.         var request = new GetPlayerStatisticsRequest();
  141.         request.StatisticNames = new List<string>() { "Year", "Month", "Day", "Hour", "Minuts", "Seconds" };
  142.  
  143.  
  144.         // request an PlayFabAPI
  145.         PlayFabClientAPI.GetPlayerStatistics(request, GetPlayerStaticsSuccess, OnPlayFabError);
  146.  
  147.     }
  148.  
  149.     private void OnPlayFabError(PlayFabError obj)
  150.     {
  151.         print("Es konnte nichts geholt werden");
  152.     }
  153.  
  154.     private void GetPlayerStaticsSuccess(GetPlayerStatisticsResult obj)
  155.     {
  156.         print("Stats wurden erfolgreich empfangen");
  157.  
  158.         // Statisken ausgeben
  159.  
  160.         foreach (var stat in obj.Statistics)
  161.         {
  162.             print("Statistic:" + stat.StatisticName + "Wert:" + stat.Value);
  163.         }
  164.     }
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement