コード例 #1
0
ファイル: WinMenu.cs プロジェクト: BLaZeKiLL/ChuzaMan
        public void Show(WinData data)
        {
            _Root.SetActive(true);

            _ChuzaCoins.text = $"{data.ChuzaCoins}";
            _DoggaCoins.text = $"{data.DoggaCoins}";
        }
コード例 #2
0
    WinData GetWinning()
    {
        WinData win = new WinData();

        win.Roll = rnd_.NextDouble();
        //Response.Write(win.Roll.ToString() + " : ");

        foreach (LootEntry le in loots_)
        {
            if (win.Roll <= le.Chance)
            {
                if (le.ItemID == 0)
                {
                    double min = (double)le.GDMin;
                    double max = (double)le.GDMax + 1;
                    win.GD     = (int)(min + ((max - min) * rnd_.NextDouble()));
                    win.ItemID = 0;
                    //Response.Write(win.GD.ToString() + " GD" + "<br>");
                }
                else
                {
                    double min = (double)le.ExpDaysMin;
                    double max = (double)le.ExpDaysMax + 1;
                    win.ExpDays = (int)(min + ((max - min) * rnd_.NextDouble()));
                    win.ItemID  = le.ItemID;
                    win.GD      = le.GDIfHave;
                    //Response.Write(win.ItemID.ToString() + " for " + win.ExpDays.ToString() + "<br>");
                }
                return(win);
            }
        }

        throw new ApiExitException("no winning");
    }
コード例 #3
0
 private void ShowWinScreenClientRpc(WinData data)
 {
     _AudioSource.PlayOneShot(_WinSound);
     FindObjectOfType <PointerManager>().Hide();
     FindObjectOfType <CameraManager>().EnableWinCam();
     FindObjectOfType <UIController>().ShowWinMenu(data);
 }
コード例 #4
0
ファイル: GameRoundData.cs プロジェクト: PatrikLukac/WinData
 public GameRoundData(Decimal stake, Int32 mode, VisibleSymbols visibleSymbols, WinData winData)
 {
     Stake          = stake;
     Mode           = mode;
     VisibleSymbols = visibleSymbols;
     WinData        = winData;
 }
コード例 #5
0
    // Checks if the player has won, lost, or is still in the game
    void GameOver()
    {
        if (!tutorial.activeInHierarchy && totalUpdates > 15)
        {
            WinData data = DetermineWin();

            int sc = 0;

            if (data.status == 1)
            {
                DataModel.dataModel.winLose = "Win";
                sc = CalculateScore(true);
            }
            else if (data.status == 2)
            {
                DataModel.dataModel.winLose = "Lose";
                sc = CalculateScore(false);
            }

            StartCoroutine(SubmitScore(sc));

            if (data.status == 1)
            {
                // The player wins
                this.score = CalculateScore(true);
                SaveMainScene();
                gameOverImage.SetActive(true);
                gameOverImage.transform.Find("TextIcon").gameObject.SetActive(false);
                gameOverImage.transform.Find("TextIconShadow").gameObject.SetActive(false);
                returnButton.SetActive(true);
                replayButton.SetActive(true);
                winText.text = "You won because " + data.reason + "!\nScore: " + sc;
                submitDataButton.SetActive(true);
                GameObject.Find("SubmitData").GetComponent <Button>().onClick.Invoke();
                submitDataButton.SetActive(false);

                frame = -1;
            }
            else if (data.status == 2)
            {
                // The player loses
                sceneActive = false;
                gameStarted = false;
                this.score  = CalculateScore(false);
                SaveMainScene();
                gameOverImage.SetActive(true);
                returnButton.SetActive(true);
                replayButton.SetActive(true);
                winText.text = "You lost because " + data.reason + "!\nScore: " + sc;
                submitDataButton.SetActive(true);
                GameObject.Find("SubmitData").GetComponent <Button>().onClick.Invoke();
                submitDataButton.SetActive(false);

                frame = -1;
            }
        }
    }
コード例 #6
0
 public void Load()
 {
     if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         var             file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
         winData = (WinData)bf.Deserialize(file);
         file.Close();
     }
 }
        public void AddWin(string name)
        {
            WinData d = Wins.FirstOrDefault(x => x.Name == name);

            d.Wins++;

            lock (collisionLock)
            {
                database.Update(d);
            }
        }
コード例 #8
0
 /// <summary>
 /// 更新UI使用的数据
 /// </summary>
 /// <param name="data">数据</param>
 public void PushData(WinData data)
 {
     foreach (var key in data.GetDataKeys())
     {
         Action <object> action = null;
         callbackMap.TryGetValue(key, out action);
         if (action != null)
         {
             action(data.GetData <object>(key));
         }
     }
 }
コード例 #9
0
ファイル: AWindow.cs プロジェクト: jscstc007/BDFramework.Core
 /// <summary>
 /// 更新UI使用的数据
 /// </summary>
 /// <param name="data">数据</param>
 public void SendMessage(WinData data)
 {
     foreach (var key in data.DataMap.Keys)
     {
         Action <object> action = null;
         callbackMap.TryGetValue(key, out action);
         if (action != null)
         {
             action(data.DataMap[key]);
         }
     }
 }
コード例 #10
0
    public void BeginExit()
    {
        //退出设置为false,否则下次进入不会调用begininit
        this.IsLoad = false;

        //1..退出时候 向win test2 发消息
        var d = WinData.Create();

        d.AddData("rotation", UnityEngine.Random.Range(-359, 359));
        UIManager.Inst.SendMessage((int)WinEnum.Win_Test2, d);

        //
        Debug.Log("退出Test Screen 1");
    }
コード例 #11
0
        public UserWinItemData[] GetWinsInGroup()
        {
            var result = new List <UserWinItemData>();
            var data   = WinData.GroupBy(g => g.RoundBetId).ToArray();

            foreach (var userWinItemData in data)
            {
                var resultItem = userWinItemData.First().Clone();
                resultItem.Amount = userWinItemData.Sum(r => r.Amount);
                result.Add(resultItem);
            }

            return(result.ToArray());
        }
コード例 #12
0
    public void BeginExit(Action <Exception> onExit)
    {
        //退出设置为false,否则下次进入不会调用begininit
        this.IsLoad = false;
        Destory();
        onExit(null);


        //1..退出时候 向win test2 发消息
        var d = WinData.Create();

        d.AddData("rotation", UnityEngine.Random.Range(-359, 359));
        UIMgr.Inst.SendMessage(WinEnum.Win_Test2, d);

        //
        Debug.Log("退出Test Screen 1");
    }
コード例 #13
0
ファイル: WndSearcher.cs プロジェクト: c1kad14/poker-miranda
        static WinData GetWindow(IntPtr parent, string className)
        {
            //List<IntPtr> result = new List<IntPtr>();
            var result = new WinData {
                Class = className, Hwnd = IntPtr.Zero
            };
            GCHandle listHandle = GCHandle.Alloc(result);

            try
            {
                var childProc = new Win32Callback(EnumWindow);
                EnumChildWindows(parent, childProc, GCHandle.ToIntPtr(listHandle));
                return(result);
            }
            finally
            {
                if (listHandle.IsAllocated)
                {
                    listHandle.Free();
                }
            }
        }
コード例 #14
0
ファイル: WndSearcher.cs プロジェクト: ramonliu/poker-miranda
 static WinData GetWindow(IntPtr parent, string className)
 {
     //List<IntPtr> result = new List<IntPtr>();
     var result = new WinData { Class = className, Hwnd = IntPtr.Zero };
     GCHandle listHandle = GCHandle.Alloc(result);
     try
     {
         var childProc = new Win32Callback(EnumWindow);
         EnumChildWindows(parent, childProc, GCHandle.ToIntPtr(listHandle));
         return result;
     }
     finally
     {
         if (listHandle.IsAllocated)
             listHandle.Free();
     }
 }
コード例 #15
0
    void TestTheRolls()
    {
        string LootID = web.Param("LootID");

        ReadLootInfo(LootID);

        /*
         * Response.Write("Loot Content for " + LootID + ":<br>");
         * foreach (LootEntry le in loots_)
         *  Response.Write(string.Format("{0:000000} : {1:0.0000}<br>", le.ItemID, le.Chance));
         * */

        Dictionary <int, TestWonItem> wons = new Dictionary <int, TestWonItem>();

        Response.Write("Rolling:<br>");
        for (int i = 0; i < 50; i++)
        {
            WinData win = GetWinning();
            try
            {
                wons[win.ItemID].Nums += 1;
            }
            catch
            {
                wons.Add(win.ItemID, new TestWonItem());
            }

            if (win.ItemID == 0)
            {
                Response.Write(string.Format("Roll: {0:0.0000}, GD: {1}<br>",
                                             win.Roll,
                                             win.GD));
            }
            else
            {
                Response.Write(string.Format("Roll: {0:0.0000}, Item: {1} for {2} days<br>",
                                             win.Roll,
                                             win.ItemID,
                                             win.ExpDays));
            }
        }

        Response.Write("Percentages:<br>");
        double AllTotals = 0;

        foreach (TestWonItem wi in wons.Values)
        {
            AllTotals += wi.Nums;
        }
        foreach (TestWonItem wi in wons.Values)
        {
            wi.Nums /= AllTotals;
        }

        foreach (int ItemID in wons.Keys)
        {
            Response.Write(string.Format("{0} : {1}%<br>", ItemID, wons[ItemID].Nums * 100));
        }

        Response.Write("<br>");
    }
コード例 #16
0
    void RollBox()
    {
        string CustomerID = web.CustomerID();
        string ItemID     = web.Param("ItemID");
        string BuyIdx     = web.Param("BuyIdx");

        // step 1: read loot box info
        ReadLootInfo(ItemID);

        // only storecat_MysteryBox can be bought for GD
        if (category_ != 3 && BuyItem3.IsGD(BuyIdx))
        {
            throw new ApiExitException("can't buy loot for GD");
        }

        // step 2: see what we won
        WinData win = GetWinning();

        // step 3: actually buy item
        int balance = 0;

        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = BuyItem3.GetBuyProcFromIdx(BuyIdx);
            sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_ItemId", ItemID);
            sqcmd.Parameters.AddWithValue("@in_BuyDays", BuyItem3.GetBuyDaysFromIdx(BuyIdx));

            if (!CallWOApi(sqcmd))
            {
                return;
            }

            reader.Read();
            balance = getInt("Balance");
        }

        // step 4: add winning!
        {
            SqlCommand sqcmd = new SqlCommand();
            sqcmd.CommandType = CommandType.StoredProcedure;
            sqcmd.CommandText = "WO_LootAddReward";
            sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
            sqcmd.Parameters.AddWithValue("@in_Roll", win.Roll);
            sqcmd.Parameters.AddWithValue("@in_LootID", ItemID);
            sqcmd.Parameters.AddWithValue("@in_ItemID", win.ItemID.ToString());
            sqcmd.Parameters.AddWithValue("@in_ExpDays", win.ExpDays.ToString());
            sqcmd.Parameters.AddWithValue("@in_GD", win.GD.ToString());

            if (!CallWOApi(sqcmd))
            {
                return;
            }

            // overwrite GD result from procedure
            reader.Read();
            win.GD = getInt("GD");
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0} {1} {2} {3}", win.ItemID, win.ExpDays, win.GD, balance));

        return;
    }
コード例 #17
0
 public void ShowWinMenu(WinData data)
 {
     _winMenu.Show(data);
 }