예제 #1
0
    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");
    }
예제 #2
0
        /// <summary>
        /// Imports file and exports it as text, then compares the result and test data.
        /// </summary>
        public void LangTextExportTest()
        {
            using (LNG lng = LNG.FromFile(filenameLng))
            {
                Assert.IsNotNull(lng, "LNG class FromFile failed.");

                lng.Export(filenameText);
            }

            Assert.IsTrue(File.Exists(filenameText));

            string[] parseddata = File.ReadAllLines(filenameText);

            int numEntries = parseddata.Length;

            Assert.IsTrue(numEntries > 0, "Unexpected number of entries.");
            Assert.AreEqual(numStrings, numEntries, 0, "Num strings mismatch.");

            for (int i = 0; i < numEntries; i++)
            {
                Assert.AreEqual(
                    testlist[i],
                    parseddata[i],
                    $"String {i} mismatch: {testlist[i]} vs {parseddata[i]}"
                    );
            }

            CleanUp();
        }
예제 #3
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");
    }
예제 #4
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);
 }
예제 #5
0
    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);
        }
    }
예제 #6
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]));
        }
    }
예제 #7
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);
     }
 }
예제 #8
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");
    }
예제 #9
0
 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);
 }
예제 #10
0
        static void Main(string[] args)
        {
            LNG lng;

            Console.WriteLine(
                "{0}\r\n{1}\r\n\r\n{2}\r\n",
                $"CTR-Tools: lng2txt - {Meta.GetSignature()}",
                "Converts LNG localization files to TXT and back.",
                Meta.GetVersion());

            if (args.Length == 0)
            {
                Console.WriteLine(
                    "{0}:\r\n\t{1}: {2}\r\n\t{3}: {4}",
                    "Usage",
                    "Convert to text", "lng2txt c:\\en.lng",
                    "Convert to .lng", "lng2txt c:\\en.txt"
                    );
                return;
            }

            Console.WriteLine("Current path: " + Environment.CurrentDirectory);

            foreach (string filename in args)
            {
                if (File.Exists(filename))
                {
                    string ext = Path.GetExtension(filename).ToLower();

                    try
                    {
                        switch (ext)
                        {
                        case ".lng":
                            lng = LNG.FromFile(filename);
                            lng.Export(Path.ChangeExtension(filename, "txt"), true);
                            continue;

                        case ".txt":
                            lng = LNG.FromText(File.ReadAllLines(filename, System.Text.Encoding.Default), true);
                            lng.Save(Path.ChangeExtension(filename, "lng"));
                            continue;

                        default:
                            Console.WriteLine("Unsupported file.");
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Error: {ex.Message}");
                        continue;
                    }
                }
            }

            Console.WriteLine("Done.");
        }
예제 #11
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);
     }
 }
예제 #12
0
 private void actionLoad_Click(object sender, EventArgs e)
 {
     if (ofd.ShowDialog() == DialogResult.OK)
     {
         lng           = LNG.FromFile(ofd.FileName);
         linesOnLoad   = lng.Entries.Count;
         langBox.Lines = lng.Entries.ToArray();
     }
 }
    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");
        }
    }
예제 #14
0
 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();
     }
 }
예제 #15
0
    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);
    }
예제 #16
0
 private void Awake()
 {
     if (Application.isEditor)
     {
         LNG.Init(m_debugLanguage);
     }
     else
     {
         Object.Destroy(base.gameObject);
     }
 }
 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"));
     }
 }
예제 #18
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);
    }
예제 #19
0
    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);
    }
예제 #20
0
        static void Main(string[] args)
        {
            Greet();

            if (args.Length > 0)
            {
                LNG lng = new LNG(args[0]);
                Console.WriteLine("Done!");
            }
            else
            {
                Console.WriteLine("No filename!");
            }
        }
예제 #21
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();
    }
예제 #22
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();
     }
 }
예제 #23
0
 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);
     }
 }
예제 #24
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"));
         }
     }
 }
예제 #25
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);
    }
예제 #26
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);
             }
         }
     }
 }
예제 #27
0
        public void LangCreateTest()
        {
            GenerateTestData();

            using (LNG lng = new LNG())
            {
                Assert.IsNotNull(lng, "LNG class empty ctor failed.");

                lng.Entries.AddRange(testlist);
                lng.Save(filenameLng);
            }

            Assert.IsTrue(File.Exists(filenameLng), "Test file doesn't exist.");

            LangParseTest();
        }
예제 #28
0
    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;
        }
    }
예제 #29
0
 public void SetLanguage(string a_lng)
 {
     LNG.Init(a_lng);
     PlayerPrefs.SetString("prefLang", a_lng);
     if (null != this.m_curLngTxt)
     {
         this.m_curLngTxt.text = a_lng;
     }
     TextLNG[] array = UnityEngine.Object.FindObjectsOfType <TextLNG>();
     foreach (TextLNG textLNG in array)
     {
         if (null != textLNG)
         {
             textLNG.TranslateText();
         }
     }
 }
예제 #30
0
        private void LangControl_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (files.Length > 0)
            {
                switch (Path.GetExtension(files[0]).ToLower())
                {
                case ".lng": lng = LNG.FromFile(files[0]); break;

                case ".txt": lng = LNG.FromText(File.ReadAllLines(files[0], System.Text.Encoding.Default)); break;

                default: MessageBox.Show("Unsupported file."); return;
                }

                langBox.Lines = lng.Entries.ToArray();
            }
        }