示例#1
0
    private void InitializeItems()
    {
        TextAsset    loadedText   = Resources.Load <TextAsset>(Define._scenarioListPath);
        ScenarioList scenarioList = JsonUtility.FromJson <ScenarioList>(loadedText.text);

        for (int i = 0; i < scenarioList._items.Count; ++i)
        {
            AddItem(scenarioList._items[i]);
        }
    }
示例#2
0
        public void Add(Scenario scenario)
        {
            if (null == scenario)
            {
                return;
            }

            ScenarioList.Add(scenario);

            scenario.Owner   = this;
            SelectedScenario = scenario;
        }
        void Start()
        {
            App app = Object.FindObjectOfType <App>();

            // Dropdown nationDropdown = FindObjectOfType<Dropdown>();
            Debug.Log("Starting Dropdown Value : " + nationDropdown.value);

            List <string> nation_choices = new List <string>()
                                           // { "Aerakrara", "An'rio", "Arozus", "Crystalice",
                                           //     "Dessak", "Feandra" };
            {
                "Bambaki",
                "Boreois",
                "Chaldea",
                "Sidero",
                "Sitari",
                "Wyvermount"
            };

            // foreach (string item in nation_choices)
            //{
            //  Debug.Log(item);
            //}
            //Aerakara 19
            //An'rio  17
            //Ditaeler 14 but not a major
            //Crystalice 16
            //Dessak 22
            //Feandra 21

            Populate(nation_choices, true, 0);
            ScenarioList scenarios = CreateScenarioList();

            app.SetMajorNations(nation_choices);
            Populate(scenarios.scenarios, false, 1);

            // Debug.Log("startNewGameScene");

            // GameObject flagPrefab = Instantiate(Resources.Load<GameObject>("Flags/Prefabs/" + nationName));
            GameObject flagPrefab = Instantiate(Resources.Load <GameObject>("Flags/Prefabs/Bambaki"));

            nationFlag.ObjectPrefab = flagPrefab.transform;
            //nationFlag.ObjectPrefab = flagPrefab.transform;
            nationFlag.UpdateDisplay();
            // nationFlag.ObjectPrefab = initialFlag;


            string nationDescriptionPath = Application.dataPath + "/StreamingAssets/Scenarios/Fictional/MajorNationsDescriptions.json";
            string descriptionListRaw    = System.IO.File.ReadAllText(nationDescriptionPath);
            var    NationDescriptions    = Newtonsoft.Json.JsonConvert.DeserializeObject <NationNames>(descriptionListRaw);

            description.text = NationDescriptions.nations[0];
        }
示例#4
0
    // Use this for initialization
    public void Start()
    {
        // Path to json File and we want the path to a certain file.
        // path = Application.streamingAssetsPath + "/scenarios.json";

        // Now we want to bring it into Unity.
        jsonString = LoadResourceTextfile("scenarios.json");

        // FromJson - We pass it the creature type so the from json it knows what to map it to.
        // Creature test - so it knows what it's working with (db)
        ScenarioList scenarioList = JsonUtility.FromJson <ScenarioList>(jsonString);

        scenario = scenarioList.scenario;
        gameController.startPage.SetActive(true);
    }
 private void updateLearningScenariosInfo()
 {
     foreach (LearningScenario learningScenario in listLearningScenarion)
     {
         ScenarioList.Add(new LearningScenarioViewModel
         {
             Name                 = learningScenario.Name,
             SelectionType        = learningScenario.SelectionParameters.Split(',')[0],
             MixSeed              = learningScenario.SelectionParameters.Split(',')[1],
             SeparationParamValue = learningScenario.SelectionParameters.Split(',')[2],
             TeacherType          = learningScenario.LearningAlgorithmName,
             AlgoParam            = learningScenario.LAParameters,
             ID = learningScenario.ID
         });
     }
     NotifyPropertyChanged();
 }
示例#6
0
        void InitData(StringGrid grid)
        {
            grid.InitLink();
            string sheetName = grid.SheetName;

            if (AdvSettingDataManager.IsDisabelSheetName(sheetName))
            {
                Debug.LogError(sheetName + " is invalid name");
                return;
            }
            if (AdvSettingDataManager.IsSettingsSheet(grid.SheetName))
            {
                SettingList.Add(grid);
            }
            else
            {
                ScenarioList.Add(grid);
            }
        }
示例#7
0
        /// <summary>
        /// Fills the lists of scenario names and paths.
        /// Creates a list item (UI) for each scenario.
        /// </summary>
        /// <returns>List is not empty</returns>
        private bool PopulateList()
        {
            ScenarioList.GetScenarioNames(out _scenarioNames, out _scenarioPaths);
            if (_scenarioNames.Count == 0)
            {
                return(false);
            }

            float y = 0;

            for (var i = 0; i < _scenarioNames.Count; i++)
            {
                CreateListItem(i, y);
                y -= _listItemMargin + _listItemHeight;
            }

            // Set height of content panel to fit its children
            SetContentHeight(Mathf.Abs(y));

            return(true); // List was not empty
        }
    private void LoadGameData()
    {
        string filePath = Path.Combine(Application.streamingAssetsPath, gameDataFileName);

        if (File.Exists(filePath))
        {
            //did not work as json!
            string dataAsJson = File.ReadAllText(filePath);
            scenarios = JsonUtility.FromJson <ScenarioList>(dataAsJson);
            Debug.Log(scenarios);
        }

        //does not work either
        //TextAsset asset = Resources.Load("scenarios.txt") as TextAsset;
        //if (asset != null){
        //    scenarios = JsonUtility.FromJson<ScenarioList>(asset.text);
        //}
        //else
        //{
        //    Debug.LogError("Cannot load game data!");
        //}
    }
示例#9
0
    public ScenarioList LoadScenarioList(string jsonName)
    {
        if (Application.platform == RuntimePlatform.OSXPlayer)
        {
            jsonName = "/Resources/Data/" + jsonName;
        }
        string filePath = Application.dataPath + jsonName;

        Debug.Log("Loading Json at " + filePath);
        if (File.Exists(filePath))
        {
            string       dataAsJson   = File.ReadAllText(filePath);
            ScenarioList scenarioList = JsonUtility.FromJson <ScenarioList>(dataAsJson);
            Debug.Log("Scenarios JSON loaded successfuly");
            return(scenarioList);
        }
        else
        {
            Debug.Log("JSON File not found");
            return(null);
        }
    }
示例#10
0
        private static void CreatScenarioList()
        {
            ScenarioList data = new ScenarioList();

            var item1 = new ScenarioList.Item();

            item1._ID    = 1;
            item1._title = "TEST1";
            data._items.Add(item1);

            var item2 = new ScenarioList.Item();

            item2._ID    = 2;
            item2._title = "TEST2";
            item2._tags.Add("Tag1");
            item2._tags.Add("Tag2");
            data._items.Add(item2);

            string jsonString = JsonUtility.ToJson(data, true);

            System.IO.File.WriteAllText(Application.dataPath + "/Resources/" + Define._scenarioListPath + ".json", jsonString);
            AssetDatabase.Refresh();
        }
示例#11
0
 public void Delete(Scenario scenario)
 {
     ScenarioList.Remove(scenario);
 }
示例#12
0
        private void QuestDetail(Session oS)
        {
            this.ScenarioStart();

            var path = oS.PathAndQuery.Split('?');

            PathName = path[0];
            PathName = PathName.Substring(1, path[0].Count() - 1);
            PathName = PathName.Replace("/", "_");

            this.ScenarioName = PathName;

            if (this.ScenarioList == null)
            {
                this.ScenarioList = new List <Scenario>();
            }
            else
            {
                this.ScenarioList.Clear();
                this.ScenarioList.TrimExcess();
            }

            JArray  jsonVal = JArray.Parse(oS.GetResponseBodyAsString()) as JArray;
            dynamic Details = jsonVal;

            this.ProgressStatus         = new LimitedValue();
            this.ProgressStatus.Max     = Details.Count;
            this.ProgressStatus.Min     = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();
            string TranslateDir = "Google";

            if (TranslateSite == TranslateKind.Naver)
            {
                TranslateDir = "Naver";
            }

            if (File.Exists(Path.Combine(MainFolder, "Translations", "Scenarios", TranslateDir, PathName + ".xml")))
            {
                foreach (var detail in Details)
                {
                    string dtl = detail.detail;
                    //string sel1 = detail.sel1_txt;
                    //string sel2 = detail.sel2_txt;

                    Scenario temp = new Scenario
                    {
                        context = RemoveWebTag(dtl),
                        index   = detail.id,
                    };
                    if (detail.charcter1_name != "null")
                    {
                        temp.Name = detail.charcter1_name;
                    }
                    else
                    {
                        temp.Name = "";
                    }

                    temp.TrName = GrandcypherClient.Current.Translations.ReplaceTranslation(temp.Name);


                    temp.TrContext = GrandcypherClient.Current.Translations.GetTranslation(TranslationType.ScenarioDetail, temp.context, TranslateSite);
                    //if (sel1 != null)
                    //{
                    //	temp.sel1_txt = RemoveWebTag(sel1);
                    //	temp.Trsel1 = Translator(temp.sel1_txt, TranslateSite);
                    //}
                    //if (sel2 != null)
                    //{
                    //	temp.sel2_txt = RemoveWebTag(sel2);
                    //	temp.Trsel2 = Translator(temp.sel2_txt, TranslateSite);
                    //}

                    ScenarioList.Add(temp);

                    this.ProgressStatus.Current++;
                    this.ProgressBar();
                }
                this.TranslatieEnd();
            }
            else
            {
                foreach (dynamic detail in Details)
                {
                    string   dtl  = detail.detail;
                    string   sel1 = detail.sel1_txt;
                    string   sel2 = detail.sel2_txt;
                    Scenario temp = new Scenario
                    {
                        context = RemoveWebTag(dtl),
                        index   = detail.id,
                    };
                    if (ScenarioList.Count == 0)
                    {
                        temp.PathName = PathName;
                    }

                    if (detail.charcter1_name != "null")
                    {
                        temp.Name = detail.charcter1_name;
                    }
                    else
                    {
                        temp.Name = "";
                    }

                    if (!ScenarioTransDisabled)
                    {
                        temp.TrName = GrandcypherClient.Current.Translations.ReplaceTranslation(temp.Name);

                        temp.TrContext = GrandcypherClient.Current.Translations.ReplaceTranslation(temp.context);
                        temp.TrContext = Translator(temp.TrContext, TranslateSite);
                        if (temp.TrContext != null)
                        {
                            temp.TrContext = temp.TrContext.Replace("정액", "");
                        }

                        if (sel1 != null)
                        {
                            temp.sel1_txt = RemoveWebTag(sel1);
                            temp.Trsel1   = Translator(temp.sel1_txt, TranslateSite);
                        }
                        if (sel2 != null)
                        {
                            temp.sel2_txt = RemoveWebTag(sel2);
                            temp.Trsel2   = Translator(temp.sel2_txt, TranslateSite);
                        }
                        #region Debug
#if DEBUG
                        Console.WriteLine("-----------------------------------------------------------");

                        Console.WriteLine(temp.Name + " : " + RemoveWebTag(temp.context));
                        Console.WriteLine(temp.TrName + " : " + temp.TrContext);
                        if (temp.sel1_txt != null)
                        {
                            Console.WriteLine(temp.sel1_txt);
                            Console.WriteLine(temp.Trsel1);
                        }
                        if (temp.sel2_txt != null)
                        {
                            Console.WriteLine(temp.sel2_txt);
                            Console.WriteLine(temp.Trsel2);
                        }
#endif
                        #endregion
                    }

                    ScenarioList.Add(temp);

                    this.ProgressStatus.Current++;
                    this.ProgressBar();
                }
                this.TranslatieEnd();
                if (!ScenarioTransDisabled)
                {
                    GrandcypherClient.Current.Translations.WriteFile(ScenarioList, TranslateSite);
                }
                else
                {
                    GrandcypherClient.Current.Translations.WriteFile(ScenarioList, TranslateKind.Raw);
                }
            }
        }
示例#13
0
 public void OnClick()
 {
     ScenarioList.EntryClicked(Scenario);
 }
示例#14
0
 public void AddScenario(Scenario scenario)
 {
     ScenarioList.Add(scenario);
 }