Beispiel #1
0
    private string determineIconToken(IconType type)
    {
        string token = "";

        if (type.Equals(IconType.Item))
        {
            token = "it";
        }
        else if (type.Equals(IconType.Skill))
        {
            token = "sk";
        }
        else if (type.Equals(IconType.GameObject))
        {
            token = "ob";
        }

        return(token);
    }
Beispiel #2
0
    public void DrawIcon()
    {
        if (!icon_type.Equals(IconType.GameObject))
        {
            if (icon_base_container != null)
            {
                GUI.DrawTexture(dimensions, icon_base_container);
            }

            if (icon_container_object != null)
            {
                GUI.DrawTexture(dimensions, icon_container_object);
            }
        }
    }
Beispiel #3
0
    // used to retrieve details from a specific file with the associated type and name
    TooltipDetails RetrieveDetails(IconType type, string name)
    {
        TooltipDetails details = new TooltipDetails();

        details.Name = name;

        Stream       stream;
        StreamReader reader;

        if (type.Equals(IconType.Item) && previousIconType != IconType.Item)
        {
            objectInfoFile   = (TextAsset)Resources.Load("ObjectDetails/item_info");
            previousIconType = IconType.Item;
        }
        else if (type.Equals(IconType.Skill) && previousIconType != IconType.Skill)
        {
            objectInfoFile   = (TextAsset)Resources.Load("ObjectDetails/skill_info");
            previousIconType = IconType.Skill;
        }
        else if (type.Equals(IconType.GameObject) && previousIconType != IconType.GameObject)
        {
            objectInfoFile   = (TextAsset)Resources.Load("ObjectDetails/object_info");
            previousIconType = IconType.GameObject;
        }

        try
        {
            stream = new MemoryStream(objectInfoFile.bytes);
            reader = new StreamReader(stream);

            string desired = "[" + determineIconToken(type) + "]" + name;
            string read_in = "";

            while (!read_in.Equals(desired))
            {
                string data = reader.ReadLine();

                if (data.Length >= desired.Length)
                {
                    read_in = data.Substring(0, desired.Length);
                }
                else
                {
                    read_in = "NULL";
                }

                if (read_in.Equals(desired))
                {
                    int extra_char_counter = 0;

                    for (int i = desired.Length; i < data.Length; i++)
                    {
                        if (data[i] != '[')
                        {
                            extra_char_counter++;
                        }
                        else
                        {
                            break;
                        }
                    }

                    details.NameColor = determineNameColor(data.Substring(desired.Length + extra_char_counter, data.Length - (desired.Length + extra_char_counter)));

                    data       = reader.ReadLine();
                    details.ID = int.Parse(data.Substring("[id]".Length, data.Length - "[id]".Length));

                    string[]     CombinedDetails = determineDetails(reader);
                    List <Color> colors          = new List <Color>();

                    details.StatisticalDetails = placeDetails(CombinedDetails, 's', colors);
                    details.StatisticalColors  = colors.ToArray();
                    colors.Clear();

                    details.DescriptiveDetails = placeDetails(CombinedDetails, 'd', colors);
                    details.DescriptiveColors  = colors.ToArray();
                    colors.Clear();

                    break;
                }
            }

            reader.Close();
            stream.Close();
        }
        catch (IOException ex) {
            Debug.Log(ex.Message);
        }

        return(details);
    }