コード例 #1
0
 public static StudentProxy instances()
 {
     if (instance == null)
     {
         instance = new StudentProxy();
     }
     return(instance);
 }
コード例 #2
0
    public void Todo(Observer t)
    {
        if (t.msg == Cmd.ShowImageAndText)
        {
            //InputFieldComponent.instance.ShowImageAndText();
            //AppFactory.instances.Todo(new Observer(Cmd.ShowImageAndText, string));
            InputFieldComponent.instance.ShowImageAndText((string)t.body);
        }

        if (t.msg == Cmd.changeColor)
        {
            StudentProxy.instances().FindScoreMax();
        }
    }
コード例 #3
0
    public void ShowMajorColor()
    {
        string       filePath = Application.streamingAssetsPath + "\\Json" + "\\json.json";
        StreamReader sr       = new StreamReader(filePath);
        string       jsonStr0 = sr.ReadLine();
        string       jsonStr1 = sr.ReadLine();
        string       jsonStr2 = sr.ReadLine();
        string       jsonStr3 = sr.ReadLine();
        string       jsonStr4 = sr.ReadLine();

        sr.Close();
        List <MajorColor> list = new List <MajorColor>();

        list.Add(JsonMapper.ToObject <MajorColor>(jsonStr0));
        list.Add(JsonMapper.ToObject <MajorColor>(jsonStr1));
        list.Add(JsonMapper.ToObject <MajorColor>(jsonStr2));
        list.Add(JsonMapper.ToObject <MajorColor>(jsonStr3));
        list.Add(JsonMapper.ToObject <MajorColor>(jsonStr4));
        for (int i = 0; i < studentImageList.Count; i++)
        {
            Major major = StudentProxy.instances().getmodellist()[i].major;
            for (int j = 0; j < list.Count; j++)
            {
                if (major == list[j].major)
                {
                    studentImageList[i].GetComponent <Image>().color = StringToColor(list[j].colorName);
                }
            }
        }
        //UnityEngine.TextAsset s = Resources.Load(FileName) as TextAsset
        //StreamReader streamreader = new StreamReader(FileName);
        //JsonReader js = new JsonReader(streamreader);
        //list = JsonMapper.ToObject<List<string>>(js);
        //Debug.Log(JsonMapper.ToObject<List<string>>(js).Count);
        //for (int i = 0; i < studentImageList.Count; i++)
        //{
        //    Major major = StudentProxy.instances().getmodellist()[i].major;
        //    switch (major)
        //    {
        //        case Major.Chemical: studentImageList[i].GetComponent<Image>().color = colorList[0];break;
        //        case Major.Math: studentImageList[i].GetComponent<Image>().color = colorList[1]; break;
        //        case Major.Chinese: studentImageList[i].GetComponent<Image>().color = colorList[2]; break;
        //        case Major.Geographic: studentImageList[i].GetComponent<Image>().color = colorList[3]; break;
        //        case Major.Physical: studentImageList[i].GetComponent<Image>().color = colorList[4]; break;
        //        default: studentImageList[i].GetComponent<Image>().color = Color.white; break;
        //    }

        //}
    }
コード例 #4
0
 public void Todo(Observer t)
 {
     if (t.msg == Cmd.DeleteMinScore)
     {
         StudentProxy.instances().DeleteMinScore();
     }
     else if (t.msg == Cmd.ShowStudentInformtion)
     {
         StudentComponent.instance.ShowStudentInformtion();
     }
     else if (t.msg == Cmd.ShowMajorColor)
     {
         StudentComponent.instance.ShowMajorColor();
     }
     else if (t.msg == Cmd.GetStudentModel)
     {
         StudentComponent.instance.studentList = StudentProxy.instances().getmodellist();
     }
 }