Skip to content
Snippets Groups Projects
Select Git revision
  • faf261b9a1c4dd821a4512d3b9e2d580adf411fd
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

DiscreteBarSlider.cs.meta

Blame
  • DisplayFacts.cs NaN GiB
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using TMPro;
    using System;
    
    public class DisplayFacts : MonoBehaviour
    {
        public HashSet<int> displayedFacts = new HashSet<int>();
    
        public GameObject prefab_Point;
        public GameObject prefab_Distance;
        public GameObject prefab_Angle;
        public GameObject prefab_Default;
    
        public int x_Start;
        public int y_Start;
        public int X_Pacece_Between_Items;
        public int y_Pacece_Between_Items;
        public int number_of_Column;
        // Start is called before the first frame update
        void Start()
        {
            //CreateDisplay();
        }
    
        // Update is called once per frame
        void Update()
        {
            UpdateDisplay2();
        }
    
        public void UpdateDisplay2()
        {
            List<Fact>.Enumerator enumerator = CommunicationEvents.Facts.GetEnumerator();
            while (enumerator.MoveNext())
            {
                int fid = enumerator.Current.Id;
                if (displayedFacts.Contains(fid))
                {
                    continue;
                }
                var obj = CreateDisplay(transform, enumerator.Current);
                obj.GetComponent<RectTransform>().localPosition = GetPosition(fid);
                displayedFacts.Add(fid);
            }
    
        }
    
        private GameObject CreateDisplay(Transform transform, Fact fact)
        {
            switch (fact)
            {
                case LineFact f:
                    {
                        var obj = Instantiate(prefab_Distance, Vector3.zero, Quaternion.identity, transform);
                        obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = "" + CommunicationEvents.Facts[f.Pid1].Id;
                        obj.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = "" + CommunicationEvents.Facts[f.Pid2].Id;
                        obj.GetComponent<FactWrapper>().fact = f;
                        return obj;
                    }
    
                case AngleFact f:
                    {
                        var obj = Instantiate(prefab_Angle, Vector3.zero, Quaternion.identity, transform);
                        obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = "" + CommunicationEvents.Facts[f.Pid1].Id;
                        obj.transform.GetChild(1).gameObject.GetComponent<TextMeshProUGUI>().text = "" + CommunicationEvents.Facts[f.Pid2].Id;
                        obj.transform.GetChild(2).gameObject.GetComponent<TextMeshProUGUI>().text = "" + CommunicationEvents.Facts[f.Pid3].Id;
                        obj.GetComponent<FactWrapper>().fact = f;
                        return obj;
                    }
    
                case PointFact f:
                    {
                        var obj = Instantiate(prefab_Point, Vector3.zero, Quaternion.identity, transform);
                        obj.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().text = "" + f.Id;
                        obj.GetComponent<FactWrapper>().fact = f;
                        return obj;
                    }
                default:
                    {
                        var obj = Instantiate(prefab_Default, Vector3.zero, Quaternion.identity, transform);
                        return obj;
                    }
            }
        }
    
        public Vector3 GetPosition(int i)
        {
            return new Vector3(x_Start + (X_Pacece_Between_Items * (i % number_of_Column)), y_Start + (-y_Pacece_Between_Items * (i / number_of_Column)), 0f);
        }
    
    }