Esempio n. 1
0
    public GeoGroupInfo Clone()
    {
        GeoGroupInfo ggi = new GeoGroupInfo();

        ggi.GeoInfos = new List <GeoInfo>();

        foreach (GeoInfo gi in GeoInfos)
        {
            ggi.GeoInfos.Add(gi.Clone());
        }

        ggi.Name                 = Name;
        ggi.FertilityRate        = FertilityRate;
        ggi.OffspringSizePercent = OffspringSizePercent;
        ggi.MatureSizePercent    = MatureSizePercent;
        ggi.MinSizePercent       = MinSizePercent;
        ggi.MaxSizePercent       = MaxSizePercent;
        ggi.StartNumber          = StartNumber;
        ggi.MaxNumber            = MaxNumber;
        ggi.GrowUpRate           = GrowUpRate;
        foreach (string s in Diets)
        {
            ggi.Diets.Add(s);
        }

        foreach (string s in Predators)
        {
            ggi.Predators.Add(s);
        }

        ggi.ResetCenterAndSortingOrder();
        ggi.RefreshInfo();

        return(ggi);
    }
Esempio n. 2
0
    public void OnSave()
    {
        if (GeoElements.Count == 0)
        {
            ConfirmPanel cp1 = UIManager.Instance.ShowUIForms <ConfirmPanel>();
            cp1.Initialize("Please draw something", "Confirm", null, delegate { cp1.CloseUIForm(); }, delegate { cp1.CloseUIForm(); });
            return;
        }

        if (Cur_GGI.Name == null)
        {
            ConfirmPanel cp1 = UIManager.Instance.ShowUIForms <ConfirmPanel>();
            cp1.Initialize("Please input the name", "Confirm", null, delegate { cp1.CloseUIForm(); }, delegate { cp1.CloseUIForm(); });
            return;
        }

        ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();

        cp.Initialize("Confirm to save? Species name: " + Cur_GGI.Name, "Confirm", "Cancel", delegate
        {
            Cur_GGI.ResetCenterAndSortingOrder();
            if (NatureController.Instance.AllGeoGroupInfo.ContainsKey(Cur_GGI.Name))
            {
                NatureController.Instance.AllGeoGroupInfo[Cur_GGI.Name] = Cur_GGI;
            }
            else
            {
                NatureController.Instance.AllGeoGroupInfo.Add(Cur_GGI.Name, Cur_GGI);
            }

            GameToDF2Manager.Instance.OnAddSpeciesToEntity(new List <string> {
                Cur_GGI.Name
            });
            UIManager.Instance.GetBaseUIForm <CreatureEditorPanel>().OnClose();
            cp.CloseUIForm();
        }, delegate { cp.CloseUIForm(); });
    }