public void ShowInfo(Vector3 a_pos)
    {
        if (Vector3.zero == a_pos)
        {
            return;
        }
        m_hideInfoTime = Time.time + 8f;
        int num      = -1;
        int a_amount = 0;

        if (m_items != null)
        {
            for (int i = 0; i < m_items.Length; i++)
            {
                if (null != m_items[i] && a_pos == m_items[i].transform.position)
                {
                    num      = m_items[i].m_type;
                    a_amount = m_items[i].m_amountOrCond;
                    break;
                }
            }
        }
        if (num != -1)
        {
            ItemDef itemDef = Items.GetItemDef(num);
            m_guiInfoName.text  = LNG.Get(itemDef.ident);
            m_guiInfoDesc.text  = LNG.Get(itemDef.ident + "_DESC");
            m_guiInfoStats.text = Items.GetStatsText(num, a_amount, true);
            m_guiItemInfo.SetActive(true);
        }
        else
        {
            m_guiItemInfo.SetActive(false);
        }
    }
Exemple #2
0
    public void SetParty(DatabasePlayer[] a_party)
    {
        this.m_txtDescription.text = ((a_party != null) ? string.Empty : LNG.Get("PARTY_DESCRIPTION"));
        this.m_txtNames.text       = string.Empty;
        this.m_txtRanks.text       = string.Empty;
        bool   flag = false;
        int    num  = (a_party == null) ? 0 : Mathf.Min(a_party.Length, 5);
        string text = string.Empty;

        this.m_aid = ((num != 0) ? new ulong[num] : null);
        for (int i = 0; i < num; i++)
        {
            text = a_party[i].name;
            if (8 < text.Length)
            {
                text = text.Substring(0, 7) + "...";
            }
            TextMesh txtNames = this.m_txtNames;
            txtNames.text = txtNames.text + text + "\n";
            TextMesh txtRanks = this.m_txtRanks;
            txtRanks.text = txtRanks.text + ((a_party[i].partyRank != 1) ? "Member" : "Admin") + "\n";
            this.m_aid[i] = a_party[i].aid;
            if (this.m_client.GetSteamId() == this.m_aid[i] && a_party[i].partyRank == 1)
            {
                flag = true;
            }
        }
        for (int j = 0; j < this.m_btnRank.Length; j++)
        {
            this.m_btnRank[j].SetActive(j < num && flag);
            this.m_btnKick[j].SetActive(j < num && (flag || this.m_client.GetSteamId() == this.m_aid[j]));
        }
    }
Exemple #3
0
    private void onPartyFeedback(NetIncomingMessage a_msg)
    {
        ePartyFeedback ePartyFeedback = (ePartyFeedback)a_msg.ReadByte();
        string         str            = a_msg.ReadString();

        switch (ePartyFeedback)
        {
        case ePartyFeedback.invite:
            m_popupIdInvite = m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_INVITED"));
            break;

        case ePartyFeedback.errorAlreadyInParty:
            m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_ALREADY_IN_PARTY"));
            break;

        case ePartyFeedback.kicked:
            m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_KICKED"));
            break;

        case ePartyFeedback.prodemoted:
            m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_PRODEMOTED"));
            break;

        case ePartyFeedback.partyFull:
            m_popupGui.ShowGui(true, LNG.Get("PARTY_POPUP_FULL"));
            break;
        }
        DebugLogReadWriteMismatch(a_msg, "onPartyFeedback");
    }
 private void Start()
 {
     this.m_guimaster          = (GUI3dMaster)UnityEngine.Object.FindObjectOfType(typeof(GUI3dMaster));
     this.m_inventory          = (InventoryGUI)UnityEngine.Object.FindObjectOfType(typeof(InventoryGUI));
     this.m_client             = (LidClient)UnityEngine.Object.FindObjectOfType(typeof(LidClient));
     this.m_craftableItems     = new List <ItemDef> [this.m_btnPages.Length];
     this.m_craftableItemTypes = new List <int> [this.m_btnPages.Length];
     this.m_itemList           = new string[this.m_btnPages.Length];
     for (int i = 0; i < this.m_btnPages.Length; i++)
     {
         this.m_craftableItems[i]     = new List <ItemDef>();
         this.m_craftableItemTypes[i] = new List <int>();
         this.m_itemList[i]           = string.Empty;
     }
     this.m_txtItems.text = string.Empty;
     for (int j = 0; j < 254; j++)
     {
         ItemDef itemDef = Items.GetItemDef(j);
         if (Items.IsCraftable(j) && itemDef.ident != null)
         {
             this.m_craftableItems[itemDef.rankReq].Add(itemDef);
             this.m_craftableItemTypes[itemDef.rankReq].Add(j);
             string[] itemList = this.m_itemList;
             int      rankReq  = itemDef.rankReq;
             itemList[rankReq] = itemList[rankReq] + LNG.Get(itemDef.ident) + "\n";
         }
     }
     this.ActivatePage(0);
 }
Exemple #5
0
 private void Start()
 {
     m_guimaster          = (GUI3dMaster)Object.FindObjectOfType(typeof(GUI3dMaster));
     m_inventory          = (InventoryGUI)Object.FindObjectOfType(typeof(InventoryGUI));
     m_client             = (LidClient)Object.FindObjectOfType(typeof(LidClient));
     m_craftableItems     = new List <ItemDef> [m_btnPages.Length];
     m_craftableItemTypes = new List <int> [m_btnPages.Length];
     m_itemList           = new string[m_btnPages.Length];
     for (int i = 0; i < m_btnPages.Length; i++)
     {
         m_craftableItems[i]     = new List <ItemDef>();
         m_craftableItemTypes[i] = new List <int>();
         m_itemList[i]           = string.Empty;
     }
     m_txtItems.text = string.Empty;
     for (int j = 0; j < 254; j++)
     {
         ItemDef itemDef = Items.GetItemDef(j);
         if (Items.IsCraftable(j) && itemDef.ident != null)
         {
             m_craftableItems[itemDef.rankReq].Add(itemDef);
             m_craftableItemTypes[itemDef.rankReq].Add(j);
             string reference = m_itemList[itemDef.rankReq];
             reference = reference + LNG.Get(itemDef.ident) + "\n";
         }
     }
     ActivatePage(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);
     }
 }
    public void ShowGui(bool a_show, int a_itemDefId = 0)
    {
        if (a_show)
        {
            JSONNode item = JsonItems.GetItem(a_itemDefId);
            if (null != item && null != this.m_itemText && null != this.m_itemRenderer)
            {
                this.m_itemText.text = string.Concat(new string[]
                {
                    "<color=#",
                    item["name_color"],
                    ">",
                    item["market_name"],
                    "</color>"
                });
                this.m_itemRenderer.renderer.material.mainTexture = Resources.Load <Texture>("inventory_steam/inventory_s_" + a_itemDefId);
            }
            base.audio.Play();
        }
        this.m_guiParent.SetActive(a_show);
        int @int = PlayerPrefs.GetInt("prefSteamDropCount", 0);

        PlayerPrefs.SetInt("prefSteamDropCount", @int + 1);
        this.m_reviewText.text = LNG.Get((@int % 2 != 1) ? "STEAM_BLUE_ICON" : "STEAM_PLEASE_REVIEW");
    }
Exemple #8
0
    private void onPartyFeedback(NetIncomingMessage a_msg)
    {
        ePartyFeedback ePartyFeedback = (ePartyFeedback)a_msg.ReadByte();
        string         str            = a_msg.ReadString();

        if (ePartyFeedback == ePartyFeedback.invite)
        {
            this.m_popupIdInvite = this.m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_INVITED"));
        }
        else if (ePartyFeedback == ePartyFeedback.errorAlreadyInParty)
        {
            this.m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_ALREADY_IN_PARTY"));
        }
        else if (ePartyFeedback == ePartyFeedback.kicked)
        {
            this.m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_KICKED"));
        }
        else if (ePartyFeedback == ePartyFeedback.prodemoted)
        {
            this.m_popupGui.ShowGui(true, str + LNG.Get("PARTY_POPUP_PRODEMOTED"));
        }
        else if (ePartyFeedback == ePartyFeedback.partyFull)
        {
            this.m_popupGui.ShowGui(true, LNG.Get("PARTY_POPUP_FULL"));
        }
        this.DebugLogReadWriteMismatch(a_msg, "onPartyFeedback");
    }
Exemple #9
0
 private void Update()
 {
     if (null != this.m_label && null != this.m_client && Time.time > this.m_nextUpdateTime)
     {
         bool flag = (base.transform.position - this.m_client.GetPos()).sqrMagnitude < this.m_displayLabelDist * this.m_displayLabelDist;
         this.m_label.SetText((!flag) ? string.Empty : LNG.Get(this.m_lngKey), true);
         this.m_nextUpdateTime = Time.time + UnityEngine.Random.Range(0.5f, 1.5f);
     }
 }
    private void RedrawList()
    {
        m_txtServerNames.text   = string.Empty;
        m_txtServerPlayers.text = string.Empty;
        m_serverIps.Clear();
        string empty = string.Empty;

        string[] array = m_lastServerList.Split(';');
        int      num   = -1;

        for (int i = 0; i < array.Length && !("STOP" == array[i]); i++)
        {
            if (-1 < num)
            {
                switch (num % 5)
                {
                case 0:
                    m_serverIps.Add(array[i]);
                    break;

                case 2:
                {
                    empty = array[i];
                    if (empty.StartsWith(" "))
                    {
                        empty = empty.Substring(1);
                    }
                    Text txtServerNames = m_txtServerNames;
                    txtServerNames.text = txtServerNames.text + empty + "\n";
                    break;
                }

                case 3:
                {
                    Text txtServerPlayers = m_txtServerPlayers;
                    txtServerPlayers.text = txtServerPlayers.text + GetServerPopulationString(int.Parse(array[i])) + "\n";
                    break;
                }
                }
                num++;
            }
            if ("START" == array[i])
            {
                num = 0;
            }
        }
        for (int j = 0; j < m_connectBtns.Length; j++)
        {
            m_connectBtns[j].SetActive(j < m_serverIps.Count);
        }
        if (string.Empty == m_txtServerNames.text)
        {
            m_txtServerNames.text = LNG.Get("NO_SERVERS_FOUND");
        }
    }
    private bool IsBattleLogging()
    {
        bool flag = m_cantLogoutTime > Time.time;

        if (flag && null != m_msgBar)
        {
            int num = (int)(m_cantLogoutTime - Time.time + 0.5f);
            m_msgBar.DisplayMessage(LNG.Get("CANT_LOGOUT_DURING_BATTLE").Replace("%1", num.ToString()), 1000);
        }
        return(flag);
    }
 private void OnGUI()
 {
     m_isActive = m_chatText.gameObject.activeInHierarchy;
     if (!m_qmunicator.IsActive(false) || !m_isActive)
     {
         return;
     }
     if (m_unreadMsgIndicator.activeSelf)
     {
         m_unreadMessages = 0;
         m_unreadMsgIndicator.SetActive(false);
         m_unreadMsgIndicator2.SetActive(false);
     }
     GUI.SetNextControlName("chatInputCom");
     m_chatString = GUI.TextField(m_chatRect, m_chatString, 100);
     if (Event.current.type != EventType.KeyUp)
     {
         return;
     }
     if (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)
     {
         m_chatString = m_chatString.Replace("\\", string.Empty);
         if (m_chatString.Length > 0)
         {
             if (!IsSpam(m_chatString))
             {
                 if (null != m_client)
                 {
                     m_client.SendChatMsg(m_chatString, false);
                 }
                 else
                 {
                     AddString(m_chatString);
                 }
             }
             else
             {
                 AddString("System§ " + LNG.Get("ANTI_SPAM_CHAT"));
             }
             m_chatString = string.Empty;
         }
         else
         {
             GUI.FocusControl((!("chatInputCom" == GUI.GetNameOfFocusedControl())) ? "chatInputCom" : string.Empty);
         }
         Event.current.Use();
     }
     if (Event.current.keyCode == KeyCode.Escape)
     {
         GUI.FocusControl(string.Empty);
         m_chatString = string.Empty;
         Event.current.Use();
     }
 }
 private void Connect(string a_ip)
 {
     if (m_steamId != 0L)
     {
         if (m_isVerbrecherVersion)
         {
             m_txtMessage.text = LNG.Get("INVALID_IP");
             return;
         }
         bool flag = m_client.Connect(m_playerName, m_pwHash, m_steamId, a_ip);
         m_txtMessage.text = ((!flag) ? LNG.Get("INVALID_IP") : LNG.Get("LOADING"));
     }
 }
    private bool IsInteracting()
    {
        bool flag = false;

        if (Input.GetButtonDown("Interact") && !m_isMoving)
        {
            for (int i = 0; i < m_repairNpcs.Length; i++)
            {
                Vector3 position = m_repairNpcs[i].transform.position;
                Vector3 pos      = m_client.GetPos();
                if (!(Mathf.Abs(position.x - pos.x) < 1.4f) || !(Mathf.Abs(position.z - pos.z) < 1.4f))
                {
                    continue;
                }
                RemoteItem handItem = m_inventory.GetHandItem();
                if (null != handItem)
                {
                    if (Items.HasCondition(handItem.m_type) && handItem.m_amountOrCond < 100)
                    {
                        ItemDef itemDef = Items.GetItemDef(handItem.m_type);
                        int     num     = (int)(1f + Items.GetValue(handItem.m_type, 100) * 0.01f * (float)(100 - handItem.m_amountOrCond));
                        num = (int)((float)num * m_repairNpcs[i].m_priceMultip + 0.5f);
                        if (m_client.GetGoldCount() >= num)
                        {
                            string a_caption = LNG.Get("REPAIR") + "\n" + LNG.Get(itemDef.ident) + "\n" + handItem.m_amountOrCond + "%\nfor " + num + " " + LNG.Get("CURRENCY") + "?";
                            m_repairPopupSessionId = m_popupGui.ShowGui(true, a_caption);
                        }
                        else
                        {
                            string a_caption2 = LNG.Get("ITEMSHOP_TOO_LESS_GOLD") + "\n" + num + " " + LNG.Get("CURRENCY");
                            m_popupGui.ShowGui(true, a_caption2);
                        }
                    }
                    else
                    {
                        m_popupGui.ShowGui(true, LNG.Get("REPAIR_NPC_NO_NEED"));
                    }
                }
                else
                {
                    m_popupGui.ShowGui(true, LNG.Get("REPAIR_NPC_HOWTO"));
                }
                flag = true;
                break;
            }
            if (flag)
            {
            }
        }
        return((Input.GetButton("Interact") && !flag) || m_forceInteractionTime > Time.time);
    }
Exemple #15
0
    private int GetClickedItemIndex(string a_clickedBtnName)
    {
        int result = -1;

        string[] array = a_clickedBtnName.Split(new char[]
        {
            '-'
        });
        if (array != null && 1 < array.Length && "sii" == array[0])
        {
            int num = -1;
            try
            {
                num = int.Parse(array[1]);
            }
            catch (Exception ex)
            {
                Debug.LogWarning("SteamInventoryGUI.cs: " + ex.ToString());
            }
            if (num > -1 && this.m_itemDetails != null && num < this.m_itemDetails.Count)
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                this.m_contextMenu.transform.position       = ray.GetPoint(3.5f);
                this.m_contextMenu.transform.localPosition += new Vector3(0.2f, -0.1f, 0f);
                int    steamItemDef = this.m_itemDetails[num].m_iDefinition.m_SteamItemDef;
                string sKey         = string.Empty;
                if (10000 > steamItemDef)
                {
                    sKey = "STEAM_INV_OPEN_CASE";
                }
                else
                {
                    int  lookItemDef = this.m_steamInventoryHandler.GetLookItemDef();
                    int  skinItemDef = this.m_steamInventoryHandler.GetSkinItemDef();
                    bool flag        = lookItemDef == steamItemDef || skinItemDef == steamItemDef;
                    if (flag)
                    {
                        sKey = "STEAM_INV_UNEQUIP";
                    }
                    else
                    {
                        sKey = "STEAM_INV_EQUIP";
                    }
                }
                this.m_txtEquipOpen.text = LNG.Get(sKey);
                result = num;
                this.m_contextMenu.SetActive(true);
            }
        }
        return(result);
    }
Exemple #16
0
 protected override void Start()
 {
     base.Start();
     this.m_textMesh = base.GetComponent <TextMesh>();
     this.m_textMesh.renderer.material.color = this.m_color;
     if (this.m_LNGkey.Length > 0)
     {
         this.m_textMesh.text = LNG.Get(this.m_LNGkey);
     }
     if (this.m_dropShadow)
     {
         this.CreateShadow();
     }
 }
Exemple #17
0
    private void ChooseItem(int a_index)
    {
        if (a_index < 0 || m_craftableItems[m_activePage].Count <= a_index)
        {
            return;
        }
        m_selectedItem = a_index;
        int      num     = m_craftableItemTypes[m_activePage][m_selectedItem];
        TextMesh txtItem = m_txtItem;
        ItemDef  itemDef = m_craftableItems[m_activePage][m_selectedItem];

        txtItem.text = LNG.Get(itemDef.ident);
        SetCraftAmount(1);
        if (null != m_itemForDisplay)
        {
            Object.Destroy(m_itemForDisplay);
        }
        GameObject gameObject = (GameObject)Resources.Load("items/item_" + num);

        if (null != gameObject)
        {
            m_itemForDisplay = (GameObject)Object.Instantiate(gameObject, m_itemDisplayParent.position, Quaternion.identity);
            m_itemForDisplay.transform.parent        = m_itemDisplayParent;
            m_itemForDisplay.transform.localScale    = Vector3.one * 2f;
            m_itemForDisplay.transform.localRotation = Quaternion.identity;
            Renderer[] componentsInChildren = m_itemForDisplay.GetComponentsInChildren <Renderer>();
            Renderer[] array = componentsInChildren;
            foreach (Renderer renderer in array)
            {
                renderer.gameObject.layer = 17;
            }
            Transform transform = m_itemForDisplay.transform.FindChild("Particles");
            if (null != transform)
            {
                transform.gameObject.SetActive(false);
            }
            Transform transform2 = m_itemForDisplay.transform.FindChild("Point light");
            if (null != transform2)
            {
                transform2.gameObject.SetActive(false);
            }
            m_txtInfoStats.text = Items.GetStatsText(num, -1);
            ItemDef itemDef2 = Items.GetItemDef(num);
            if (itemDef2.ident != null && itemDef2.ident.Length > 0 && string.Empty == m_txtInfoStats.text)
            {
                m_txtInfoStats.text = LNG.Get(itemDef2.ident + "_DESC");
            }
        }
        UpdateNeedHave();
    }
 public void Showtime(int a_itemDefToWin, int a_generatorDef)
 {
     this.m_gui.SetActive(true);
     this.m_btnClose.SetActive(false);
     this.m_itemDefToWin       = a_itemDefToWin;
     this.m_timeToSlowdown     = Time.time + UnityEngine.Random.Range(0f, 1f);
     this.m_curSpeed           = this.m_speed;
     this.m_newItemTxt.text    = LNG.Get("STEAM_INV_NEW_ITEM") + "\n ";
     this.m_setWinningItemFlag = false;
     this.GetItemDefsFromGenerator(a_generatorDef);
     for (int i = 0; i < this.m_displayItems.Length; i++)
     {
         this.ChangeItem(i, 0);
     }
 }
 private void Connect(string a_ip)
 {
     if (this.m_steamId != 0UL)
     {
         if (this.m_isVerbrecherVersion)
         {
             this.m_txtMessage.text = LNG.Get("INVALID_IP");
         }
         else
         {
             bool flag = this.m_client.Connect(this.m_playerName, this.m_pwHash, this.m_steamId, a_ip);
             this.m_txtMessage.text = ((!flag) ? LNG.Get("INVALID_IP") : LNG.Get("LOADING"));
         }
     }
 }
Exemple #20
0
    public static string GetStatsText(int a_type, int a_amount, bool a_displayValue = false)
    {
        string  text    = string.Empty;
        ItemDef itemDef = GetItemDef(a_type);

        if (itemDef.ident != null && itemDef.ident.Length > 0)
        {
            if (a_amount > -1 && HasAmountOrCondition(a_type))
            {
                text = ((!IsStackable(a_type)) ? LNG.Get("CONDITION") : LNG.Get("AMOUNT")) + ": " + a_amount + ((!IsStackable(a_type)) ? "%" : string.Empty) + "\n";
            }
            if (a_displayValue)
            {
                string text2 = text;
                text = text2 + LNG.Get("VALUE") + ": " + (int)(GetValue(a_type, a_amount) + 0.5f) + " " + LNG.Get("CURRENCY") + "\n";
            }
            if (itemDef.damage > 5f)
            {
                string text2 = text;
                text = text2 + LNG.Get("DAMAGE") + ": " + itemDef.damage + "\n";
                if (itemDef.ammoItemType > 0)
                {
                    string  str      = text;
                    ItemDef itemDef2 = GetItemDef(itemDef.ammoItemType);
                    text = str + LNG.Get(itemDef2.ident) + "\n";
                }
            }
            else if (itemDef.healing > 0f)
            {
                if (IsShoes(a_type))
                {
                    string text2 = text;
                    text = text2 + LNG.Get("SPEED") + ": +" + (int)(itemDef.healing * 100.0001f) + "%\n";
                }
                else if (IsBody(a_type))
                {
                    string text2 = text;
                    text = text2 + LNG.Get("ARMOR") + ": " + (int)((1f - itemDef.healing) * 100.0001f) + "%\n";
                }
                else
                {
                    string text2 = text;
                    text = text2 + LNG.Get("ENERGY") + ": " + itemDef.healing + "\n";
                }
            }
        }
        return(text);
    }
Exemple #21
0
 private void LateUpdate()
 {
     if (Time.timeSinceLevelLoad < 1f)
     {
         return;
     }
     if (null != this.m_guimaster)
     {
         string clickedButtonName = this.m_guimaster.GetClickedButtonName();
         if (string.Empty != clickedButtonName)
         {
             if (this.IsActive(true))
             {
                 if (clickedButtonName.Length == 1)
                 {
                     try
                     {
                         this.ActivateGui((eActiveApp)int.Parse(clickedButtonName));
                     }
                     catch (Exception message)
                     {
                         Debug.Log(message);
                     }
                 }
                 else if (clickedButtonName.StartsWith("HELP_"))
                 {
                     this.m_helpText.text = LNG.Get(clickedButtonName + "_TEXT");
                 }
                 else if (null != this.m_guiCloseBtn && this.m_guiCloseBtn.name == clickedButtonName)
                 {
                     this.SetVisible(false);
                 }
                 else if (null != this.m_guiQuitBtn && this.m_guiQuitBtn.name == clickedButtonName)
                 {
                     QuitGameGUI quitGameGUI = (QuitGameGUI)UnityEngine.Object.FindObjectOfType(typeof(QuitGameGUI));
                     if (null != quitGameGUI)
                     {
                         quitGameGUI.ShowGui(true);
                     }
                 }
             }
             else if (null != this.m_guiComBtn && this.m_guiComBtn.name == clickedButtonName)
             {
                 this.SetVisible(true);
             }
         }
     }
 }
    public void TranslateText()
    {
        string text      = LNG.Get(m_lngKey);
        Text   component = GetComponent <Text>();

        if (null != component)
        {
            component.text = text;
            return;
        }
        TextMesh component2 = GetComponent <TextMesh>();

        if (null != component2)
        {
            component2.text = text;
        }
    }
Exemple #23
0
    public void TranslateText()
    {
        string text      = LNG.Get(this.m_lngKey);
        Text   component = base.GetComponent <Text>();

        if (null != component)
        {
            component.text = text;
        }
        else
        {
            TextMesh component2 = base.GetComponent <TextMesh>();
            if (null != component2)
            {
                component2.text = text;
            }
        }
    }
 private void OnEnable()
 {
     this.m_page = 0;
     this.m_invitedSteamIds.Clear();
     this.m_client = UnityEngine.Object.FindObjectOfType <LidClient>();
     if (null != this.m_client)
     {
         this.m_charData.Clear();
         for (int i = 0; i < this.m_client.m_playerData.Length; i++)
         {
             if (this.m_client.m_playerData[i].name != null && 1 < this.m_client.m_playerData[i].name.Length)
             {
                 this.m_charData.Add(this.m_client.m_playerData[i]);
             }
         }
     }
     else if (this.m_charData.Count == 0)
     {
         for (int j = 0; j < 90; j++)
         {
             CharData item = default(CharData);
             item.name = "Ethan " + j + " the very very great!";
             item.aid  = (ulong)((long)(1337 + j));
             this.m_charData.Add(item);
         }
     }
     this.UpdateList();
     if (null != this.m_pageText)
     {
         this.m_pageText.text = "Page: <color=\"white\">";
         int num = (this.m_charData.Count - 1) / 36 + 1;
         for (int k = 0; k < num; k++)
         {
             TextMesh pageText = this.m_pageText;
             pageText.text = pageText.text + " " + (k + 1);
         }
         TextMesh pageText2 = this.m_pageText;
         pageText2.text += "</color>";
     }
     this.m_descriptionText.text = ((!this.m_invitePartyMode) ? LNG.Get("PLAYERS_ONLINE_DESC") : LNG.Get("PLAYERS_INVITE_DESC"));
 }
    public string GetMissionText(Mission a_mission)
    {
        string text = (a_mission.m_type != eMissiontype.eDestroy) ? LNG.Get("MISSION_PERSON_" + a_mission.m_objPerson.ToString("d")) : LNG.Get("MISSION_OBJECT_" + a_mission.m_objObject.ToString("d"));

        return(string.Concat(new string[]
        {
            LNG.Get("MISSION"),
            ":\n",
            LNG.Get("MISSION_TYPE_" + a_mission.m_type.ToString("d")),
            " ",
            text,
            "\n\n",
            LNG.Get("LOCATION"),
            ": ",
            LNG.Get("MISSION_LOCATION_" + a_mission.m_location.ToString("d")),
            "\n",
            LNG.Get("REWARD"),
            ": ",
            a_mission.m_xpReward.ToString("d"),
            " XP\n"
        }));
    }
 private void LateUpdate()
 {
     if (null != this.m_guimaster)
     {
         string clickedButtonName      = this.m_guimaster.GetClickedButtonName();
         string rightClickedButtonName = this.m_guimaster.GetRightClickedButtonName();
         string text = (!(string.Empty != clickedButtonName)) ? rightClickedButtonName : clickedButtonName;
         if (string.Empty != text)
         {
             if (text.StartsWith("btnpe_") && null != this.m_client)
             {
                 ulong num = 0UL;
                 try
                 {
                     num = ulong.Parse(text.Substring("btnpe_".Length));
                 }
                 catch (Exception)
                 {
                 }
                 if (0UL < num)
                 {
                     if (this.m_invitePartyMode)
                     {
                         if (!this.m_invitedSteamIds.Contains(num) && this.m_client.GetSteamId() != num)
                         {
                             this.m_client.SendPartyRequest(ePartyControl.invite, num);
                             this.m_invitedSteamIds.Add(num);
                             this.UpdateList();
                             this.m_descriptionText.text = LNG.Get("PARTY_SENT_INVITE");
                         }
                     }
                     else if (string.Empty != clickedButtonName)
                     {
                         if (Global.isSteamActive)
                         {
                             SteamFriends.ActivateGameOverlayToUser("steamid", new CSteamID(num));
                         }
                     }
                     else if (this.m_client.GetSteamId() != num)
                     {
                         if (this.m_mutedSteamIds.Contains(num))
                         {
                             this.m_mutedSteamIds.Remove(num);
                         }
                         else
                         {
                             this.m_mutedSteamIds.Add(num);
                         }
                         this.UpdateList();
                     }
                 }
             }
             else if (text.StartsWith("btn_page_"))
             {
                 try
                 {
                     this.m_page = int.Parse(text.Substring("btn_page_".Length)) - 1;
                     this.UpdateList();
                 }
                 catch (Exception)
                 {
                 }
             }
         }
     }
 }
Exemple #27
0
        internal static void HandleChatCommand(string text, ServerPlayer player, NetIncomingMessage msg)
        {
            var server = (LidServer)UnityEngine.Object.FindObjectOfType(typeof(LidServer));
            var p_pos  = player.GetPosition();

            string[] commands = text.Split(' ');

            switch (commands[0])
            {
            case "/tp-p":
                var re_name = server.GetPlayerByName(commands[1].ToString()).m_name.ToString();
                var re_pos  = server.GetPlayerByName(commands[1].ToString()).GetPosition();
                if (player.m_isAdmin == true && re_name == commands[1])
                {
                    player.SetPosition(re_pos);
                    server.SendMessageToPlayerLocal("Teleported to player: <color='#ffa500ff'>" + re_name.ToString() + "</color>.", player, msg);
                    Debug.Log(player.m_name + " Teleported to: " + commands[1].ToString() + "!");
                }
                else if (re_name == null)
                {
                    server.SendMessageToPlayerLocal("Please Enter the name of the player/nto teleport to after '/tp-p'/n EG: '/tp=p UserName'", player, msg);
                }
                break;


            case "/tp-all":
                if (player.m_isAdmin == true)
                {
                    for (int i = 0; i < server.m_players.Length; i++)
                    {
                        server.m_players[i].SetPosition(p_pos);
                    }
                }
                break;

            case "/tp":
                if ("HomeTown" == commands[1] && player.m_isAdmin == true)
                {
                    var loc_ht = new Vector3(-909, 0, 612);
                    player.SetPosition(loc_ht);
                }
                else if ("Terminus" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-925, 0, 869);
                    player.SetPosition(loc);
                }
                else if ("Garbage" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-646, 0, 1054);
                    player.SetPosition(loc);
                }
                else if ("Castle" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-267, 0, 178);
                    player.SetPosition(loc);
                }
                else if ("Area42" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-1030, 0, -274);
                    player.SetPosition(loc);
                }
                else if ("Fort-B" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-1043, 0, 14);
                    player.SetPosition(loc);
                }
                else if ("GasTown" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-1054, 0, 310);
                    player.SetPosition(loc);
                }
                else if ("West-Port" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(1113, 0, 109);
                    player.SetPosition(loc);
                }
                else if ("Madison" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-643, 0, -1033);
                    player.SetPosition(loc);
                }
                else if ("Venmore" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-407, 0, 647);
                    player.SetPosition(loc);
                }
                else if ("Valley" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-1004, 0, -1044);
                    player.SetPosition(loc);
                }
                else if ("Alexandria" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(341, 0, 161);
                    player.SetPosition(loc);
                }
                else if ("Riverside" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(430, 0, 735);
                    player.SetPosition(loc);
                }
                else if ("Tallahassee" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(94, 0, 1014);
                    player.SetPosition(loc);
                }
                else if ("Airport" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(-355, 0, 1053);
                    player.SetPosition(loc);
                }
                else if ("PowePlant" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(1192, 0, 1184);
                    player.SetPosition(loc);
                }
                else if ("GasRanch" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(681, 0, 1158);
                    player.SetPosition(loc);
                }
                else if ("Riverside-SZ" == commands[1] && player.m_isAdmin == true)
                {
                    var loc = new Vector3(628, 0, 631);
                    player.SetPosition(loc);
                }
                else if ("/tp" == commands[0] && commands.Length > 2 && player.m_isAdmin == true)
                {
                    int    num9       = 0;
                    int    num10      = 0;
                    string final_dest = "X:" + num9.ToString() + " Z:" + num10.ToString();
                    try
                    {
                        num9  = int.Parse(commands[1]);
                        num10 = int.Parse(commands[2]);
                    }
                    catch (Exception)
                    {
                        if (num9 != 1 - 12000 && num10 != 1 - 12000)
                        {
                            server.SendMessageToPlayerLocal("Please use correctly EG: /tp 123 123", player, msg);
                        }
                    }
                    if (num9 != 1 - 12000 && num10 != 1 - 12000)
                    {
                        server.SendMessageToPlayerLocal("Please use correctly EG: /tp 123 123", player, msg);
                    }
                    if (num9 != 0 && num10 != 0)
                    {
                        player.SetPosition(new Vector3(num9, 0f, num10));
                        num9.ToString();
                        num10.ToString();
                        server.SendMessageToPlayerLocal(LNG.Get("TO_POS").Replace("[dest]", num9.ToString() + " " + num10.ToString()), player, msg);
                    }
                }
                break;

            case "/help-skin":
                server.SendMessageToPlayerLocal("Usage for /buff:/n/buff status 'Freezing, Bleeding, Clear' Note: /buff can only applied to YOUR char rn ", player, msg);
                break;

            default:
                break;
            }
            switch (commands[1])
            {
            case "prefill":
                server.SendMessageToPlayerLocal("prefill2", player, msg);
                break;

            default:
                break;
            }
        }
	private bool DisplayMessage(eMsg a_msg)
	{
		bool flag = false;
		int a_prio = 100;
		Vector3 pos = m_client.GetPos();
		switch (a_msg)
		{
		case eMsg.eEatFood:
			flag = (m_inventoryGui.IsVisible() && m_inventoryGui.HasFood());
			break;
		case eMsg.eBuildBuilding:
			flag = (m_inventoryGui.IsVisible() && m_inventoryGui.HasBuilding());
			break;
		case eMsg.eBuildBuilding2:
		{
			int num;
			if (!m_inventoryGui.IsVisible())
			{
				ItemDef itemDef = Items.GetItemDef(m_client.GetHandItem());
				num = ((itemDef.buildingIndex > 0) ? 1 : 0);
			}
			else
			{
				num = 0;
			}
			flag = ((byte)num != 0);
			break;
		}
		case eMsg.eShovel:
			flag = (m_inventoryGui.IsVisible() && m_inventoryGui.HasItemType(109));
			break;
		case eMsg.eStarving:
			flag = (0f == m_client.GetEnergy());
			a_prio = 110;
			break;
		case eMsg.ePickupItem:
		{
			RemoteItem nearestItem = m_client.GetNearestItem(pos);
			flag = (null != nearestItem && 25f > (nearestItem.transform.position - pos).sqrMagnitude);
			break;
		}
		case eMsg.eGatherResource:
		{
			RemoteBuilding nearestResource = m_client.GetNearestResource(pos);
			flag = (null != nearestResource && 25f > (nearestResource.transform.position - pos).sqrMagnitude);
			break;
		}
		case eMsg.eAttackEnemy:
		{
			RemoteCharacter nearestNpc = m_client.GetNearestNpc(pos);
			flag = (null != nearestNpc && 36f > (nearestNpc.transform.position - pos).sqrMagnitude);
			break;
		}
		case eMsg.eDriveCar:
		{
			RemoteCharacter nearestCharacter2 = m_client.GetNearestCharacter(pos, true);
			flag = (null != nearestCharacter2 && 36f > (nearestCharacter2.transform.position - pos).sqrMagnitude);
			break;
		}
		case eMsg.eChat:
		case eMsg.ePlayerProfile:
		{
			RemoteCharacter nearestCharacter = m_client.GetNearestCharacter(pos);
			flag = (null != nearestCharacter && 49f > (nearestCharacter.transform.position - pos).sqrMagnitude);
			break;
		}
		}
		if (flag)
		{
			m_msgBar.DisplayMessage(LNG.Get("TUTORIAL_MESSAGE_" + (int)a_msg), a_prio);
		}
		return flag;
	}
 private void Start()
 {
     DisplayMessage(LNG.Get("PRESS_H_FOR_HELP"));
 }
    private bool DisplayMessage(TutorialMessages.eMsg a_msg)
    {
        bool    flag   = false;
        int     a_prio = 100;
        Vector3 pos    = this.m_client.GetPos();

        switch (a_msg)
        {
        case TutorialMessages.eMsg.ePickupItem:
        {
            RemoteItem nearestItem = this.m_client.GetNearestItem(pos);
            flag = (null != nearestItem && 25f > (nearestItem.transform.position - pos).sqrMagnitude);
            break;
        }

        case TutorialMessages.eMsg.eEatFood:
            flag = (this.m_inventoryGui.IsVisible() && this.m_inventoryGui.HasFood());
            break;

        case TutorialMessages.eMsg.eDriveCar:
        {
            RemoteCharacter nearestCharacter = this.m_client.GetNearestCharacter(pos, true);
            flag = (null != nearestCharacter && 36f > (nearestCharacter.transform.position - pos).sqrMagnitude);
            break;
        }

        case TutorialMessages.eMsg.eGatherResource:
        {
            RemoteBuilding nearestResource = this.m_client.GetNearestResource(pos);
            flag = (null != nearestResource && 25f > (nearestResource.transform.position - pos).sqrMagnitude);
            break;
        }

        case TutorialMessages.eMsg.eAttackEnemy:
        {
            RemoteCharacter nearestNpc = this.m_client.GetNearestNpc(pos);
            flag = (null != nearestNpc && 36f > (nearestNpc.transform.position - pos).sqrMagnitude);
            break;
        }

        case TutorialMessages.eMsg.eStarving:
            flag   = (0f == this.m_client.GetEnergy());
            a_prio = 110;
            break;

        case TutorialMessages.eMsg.eChat:
        case TutorialMessages.eMsg.ePlayerProfile:
        {
            RemoteCharacter nearestCharacter2 = this.m_client.GetNearestCharacter(pos, false);
            flag = (null != nearestCharacter2 && 49f > (nearestCharacter2.transform.position - pos).sqrMagnitude);
            break;
        }

        case TutorialMessages.eMsg.eBuildBuilding:
            flag = (this.m_inventoryGui.IsVisible() && this.m_inventoryGui.HasBuilding());
            break;

        case TutorialMessages.eMsg.eShovel:
            flag = (this.m_inventoryGui.IsVisible() && this.m_inventoryGui.HasItemType(109));
            break;

        case TutorialMessages.eMsg.eBuildBuilding2:
            flag = (!this.m_inventoryGui.IsVisible() && Items.GetItemDef(this.m_client.GetHandItem()).buildingIndex > 0);
            break;
        }
        if (flag)
        {
            this.m_msgBar.DisplayMessage(LNG.Get("TUTORIAL_MESSAGE_" + (int)a_msg), a_prio);
        }
        return(flag);
    }