Ejemplo n.º 1
0
 private void SetupDebugHUDView()
 {
     if (string.IsNullOrEmpty(this._debugHUDViewPrefabPath))
     {
         TimiDebug.LogWarningColor("Debug hud view prefab path not set", LogColor.orange);
         return;
     }
     PrefabLoader.Instance.InstantiateAsynchronous(this._debugHUDViewPrefabPath, this.MainCanvas.transform);
 }
Ejemplo n.º 2
0
 public List <StarData> GetAllStars()
 {
     if (this._data == null)
     {
         TimiDebug.LogWarningColor("No star data", LogColor.grey);
         return(new List <StarData>());
     }
     return(this._data.stars);
 }
Ejemplo n.º 3
0
        private void Awake()
        {
            if (UIRootView.Instance != null)
            {
                TimiDebug.LogWarningColor("There should never be more than one UIRootView in the scene!", LogColor.orange);
            }
            UIRootView._instance = this;

            this.SetupDebugHUDView();
        }
Ejemplo n.º 4
0
        // Reads a CSV that is formatted as comma separated values per line
        // The first line must contain the legend
        public static CSVResult ReadCSVFile(string filePath)
        {
            FileStream fileStream = FileUtils.OpenFileStream(filePath, FileMode.Open, FileAccess.Read);

            if (fileStream == null)
            {
                return(null);
            }

            StreamReader streamReader = new StreamReader(fileStream);

            if (streamReader.Peek() < 0)
            {
                TimiDebug.LogErrorColor("Empty file", LogColor.grey);
                return(null);
            }

            CSVResult result = new CSVResult();

            // Read the legend from the first line
            string legendLine = streamReader.ReadLine();

            string[] legend = legendLine.Split(',');
            for (int i = 0; i < legend.Length; ++i)
            {
                result.keysPerItem.Add(legend[i]);
            }

            int lineNumber = 0;

            while (streamReader.Peek() >= 0)
            {
                ++lineNumber;

                string   line  = streamReader.ReadLine();
                string[] words = line.Split(',');

                if (result.keysPerItem.Count != words.Length)
                {
                    TimiDebug.LogWarningColor("Malformed item on line number: " + lineNumber, LogColor.grey);
                    continue;
                }

                CSVItem item = new CSVItem();
                for (int i = 0; i < result.keysPerItem.Count; ++i)
                {
                    item.values[result.keysPerItem[i]] = words[i];
                }
                result.items.Add(item);
            }

            fileStream.Close();

            return(result);
        }
Ejemplo n.º 5
0
        public static T Service <T>() where T : class, new()
        {
            IService service = null;

            if (_services.TryGetValue(typeof(T), out service))
            {
                return(service as T);
            }
            TimiDebug.LogWarningColor("No service registered for type " + typeof(T).Name, LogColor.red);
            // TODO: currently this does not work for services that are monobehaviours
            service = new T() as IService;
            ServiceLocator.RegisterService <T>(service);
            return(service as T);
        }
Ejemplo n.º 6
0
 private void Start()
 {
     if (this._fpsCounterTextMesh == null)
     {
         TimiDebug.LogWarningColor("FPS counter text mesh not set", LogColor.orange);
         GameObject.Destroy(this.gameObject);
     }
     if (this._root == null)
     {
         TimiDebug.LogWarningColor("Root not set", LogColor.orange);
         GameObject.Destroy(this.gameObject);
     }
     this._root.gameObject.SetActive(this._isEnabled);
 }
Ejemplo n.º 7
0
    private void Start()
    {
        if (this._harness == null)
        {
            TimiDebug.LogWarningColor("Harness not set", LogColor.orange);
            GameObject.Destroy(this);
            return;
        }
        if (this._meshFilter == null)
        {
            TimiDebug.LogWarningColor("Mesh Filter not set", LogColor.orange);
            GameObject.Destroy(this);
            return;
        }

        this.GenerateStars(this._meshFilter);
//        this.GenerateOneStar(this._meshFilter);
    }