Esempio n. 1
0
 private void Update()
 {
     if (this.m_gui.activeSelf)
     {
         float deltaTime = Time.deltaTime;
         if (this.m_curSpeed > 0.01f)
         {
             for (int i = 0; i < this.m_displayItems.Length; i++)
             {
                 Vector3 localPosition = this.m_displayItems[i].transform.localPosition;
                 this.m_displayItems[i].transform.localPosition += Vector3.right * deltaTime * this.m_curSpeed;
                 if (this.m_displayItems[i].transform.localPosition.x > 0.085f)
                 {
                     this.m_displayItems[i].transform.localPosition -= Vector3.right * 0.6f;
                     int a_newDefId = 0;
                     if (this.m_curSpeed < 0.2f && !this.m_setWinningItemFlag)
                     {
                         a_newDefId = this.m_itemDefToWin;
                         this.m_setWinningItemFlag = true;
                     }
                     this.ChangeItem(i, a_newDefId);
                 }
                 if (localPosition.x < 0.015f && 0.015f < this.m_displayItems[i].transform.localPosition.x && null != base.audio)
                 {
                     base.audio.Play();
                 }
             }
             if (Time.time > this.m_timeToSlowdown)
             {
                 this.m_curSpeed *= 1f - deltaTime * this.m_slowDownRate;
             }
         }
         else if (!this.m_btnClose.activeSelf)
         {
             JSONNode item = JsonItems.GetItem(this.m_itemDefToWin);
             if (null != item)
             {
                 this.m_newItemTxt.text = LNG.Get("STEAM_INV_NEW_ITEM") + "\n " + item["market_name"];
                 if (null != this.m_client)
                 {
                     this.m_client.SendChatMsg(":#~" + item["market_name"], false);
                 }
                 else
                 {
                     ComChatGUI comChatGUI = UnityEngine.Object.FindObjectOfType <ComChatGUI>();
                     comChatGUI.AddString("Ethan The just opened a case and received: \n<color=\"red\">" + item["market_name"] + "</color>");
                 }
             }
             GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(this.m_audioEffect);
             gameObject.audio.clip   = this.m_successSound;
             gameObject.audio.volume = 0.4f;
             gameObject.audio.Play();
             this.m_btnClose.SetActive(true);
         }
     }
     if (Application.isEditor && Input.GetKeyDown(KeyCode.L))
     {
         this.Showtime(20009, 1004);
     }
 }
Esempio n. 2
0
 private void SendAuth()
 {
     if (m_client != null && m_client.ConnectionStatus == NetConnectionStatus.Connected && m_serverCon != null)
     {
         m_chat         = (ComChatGUI)Object.FindObjectOfType(typeof(ComChatGUI));
         m_inventory    = (InventoryGUI)Object.FindObjectOfType(typeof(InventoryGUI));
         m_hud          = (Hud)Object.FindObjectOfType(typeof(Hud));
         m_map          = (MapGUI)Object.FindObjectOfType(typeof(MapGUI));
         m_partyGui     = (PartyGUI)Object.FindObjectOfType(typeof(PartyGUI));
         m_popupGui     = (PopupGUI)Object.FindObjectOfType(typeof(PopupGUI));
         m_clientInput  = (ClientInput)Object.FindObjectOfType(typeof(ClientInput));
         m_missionObjs  = (MissionObjective[])Object.FindObjectsOfType(typeof(MissionObjective));
         m_specialAreas = (SpecialArea[])Object.FindObjectsOfType(typeof(SpecialArea));
         Debug.Log("Connected to server ... loading level complete ... send AUTH at " + Time.time);
         NetOutgoingMessage netOutgoingMessage = m_serverCon.Peer.CreateMessage();
         netOutgoingMessage.Write(MessageIds.Auth);
         netOutgoingMessage.Write(m_name);
         netOutgoingMessage.Write(m_pwhash);
         netOutgoingMessage.Write(m_id);
         netOutgoingMessage.Write("1.0.1");
         netOutgoingMessage.Write((byte)PlayerPrefs.GetInt("prefAppearance", 0));
         m_serverCon.SendMessage(netOutgoingMessage, NetDeliveryMethod.ReliableOrdered, 1);
     }
 }