Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            NeedClass a = Factory.INSTANCE.getNeedClass(GlobelEngine.INSTANCE.getSystemType());

            MessageBox.Show(a.getstring());
        }
Ejemplo n.º 2
0
    private void SetGrid(NeedClass _needClass)
    {
        GameObject item = GameObject.Instantiate(NeedItem) as GameObject;
        NeedItem   n    = item.AddComponent <NeedItem>();

        n.id      = _needClass.id;
        n.imageTr = ImageTr;
        item.transform.Find("Image").GetComponent <Image>().sprite = SpritesManager.Instance.GetSprite(_needClass.id);
        item.transform.SetParent(NeedGrid);
        item.transform.localScale = new Vector3(1, 1, 1);
        item.transform.Find("Count").GetComponent <Text>().text = _needClass.count.ToString();
    }
Ejemplo n.º 3
0
 public bool FulfillNeed(NeedClass _need, bool _fulfill, Transform _fountain)
 {
     _need.fulfilling = _fulfill;
     if (_need.needValue <= 0)
     {
         //_fountain.GetComponent<ActionObjectScript>().isTaken = false;
         _need.fulfilling = false;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
    public static void ImportNeeds()
    {
        string        dirpath = Application.dataPath + "/Data/Needs";
        DirectoryInfo d       = new DirectoryInfo(dirpath);

        foreach (var item in d.GetFiles("*.xml"))
        {
            XmlSerializer serializer = new XmlSerializer(typeof(NeedClass));
            string        file       = item.FullName;
            using (StreamReader sw1 = new StreamReader(file, Encoding.GetEncoding("ISO-8859-2")))
            {
                NeedClass _need = serializer.Deserialize(sw1) as NeedClass;
                GameManager.instance.needsList.Add(_need);
            }
        }
        Debug.Log("Load Complete -  Needs amount: " + GameManager.instance.needsList.Count);
    }