Advertisement
Marlingaming

Find DataSheet using ID

Aug 16th, 2022 (edited)
1,220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System.Collections;
  2. using System.CollectionsGeneric;
  3. using UnityEngine;
  4. using UnityEngine.VI;
  5. using System.IO;
  6. using System.Linq;
  7.  
  8. public class InfoLookUp : MonoBehaviour
  9. {
  10.     string Path;
  11.     string [] Items;
  12.     string [] Results;
  13.     public void GetItemList(list,id)
  14.     {
  15.         if (list == "Planets")
  16.         {
  17.             string Path = Application.StreamingAssetsPath + "/list/Planets.txt";
  18.         }
  19.         else if (list == "Treaties")
  20.         {
  21.             string Path = Application.StreamingAssetsPath + "/list/Treaties.txt";
  22.         }
  23.         else if (list == "Org_Groups")
  24.         {
  25.             string Path = Application.StreamingAssetsPath + "/list/Org_Groups.txt";
  26.         }
  27.         else if (list == "Loc_Groups")
  28.         {
  29.             string Path = Application.StreamingAssetsPath + "/list/Loc_Groups.txt";
  30.         }
  31.         else if (list == "People")
  32.         {
  33.             string Path = Application.StreamingAssetsPath + "/list/People.txt";
  34.         }
  35.         Items = File.ReadAllLines(Path);
  36.         foreach( string line in Items){
  37.             if (string.sub(line,1,1) == "{"}){
  38.                 void DataSheet = {line};
  39.                 if (DataSheet[1] == id){
  40.                     return DataSheet;
  41.                 }
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement