예제 #1
0
    public void ShowTextObject(string textID, GameObject obj)
    {
        FBClassData   TextObject = FBGameData.instance.getClassData("TextUIObject");
        FBClassObject objTmp     = TextObject.getObject("TextID", new FBValue(FBDataType.String, textID));
        string        name       = TextObject.getObject("TextID", new FBValue(FBDataType.String, textID)).getFieldValue("Name").stringValue;
        string        culture    = TextObject.getObject("TextID", new FBValue(FBDataType.String, textID)).getFieldValue("Culture").stringValue;
        string        author     = TextObject.getObject("TextID", new FBValue(FBDataType.String, textID)).getFieldValue("Author").stringValue;
        string        content    = TextObject.getObject("TextID", new FBValue(FBDataType.String, textID)).getFieldValue("Content").stringValue;

        obj.transform.findChildRecursively("Name").GetComponentInChildren <Text>().text    = name;
        obj.transform.findChildRecursively("Culture").GetComponentInChildren <Text>().text = culture;
        obj.transform.findChildRecursively("Author").GetComponentInChildren <Text>().text  = author;
        obj.transform.findChildRecursively("Content").GetComponentInChildren <Text>().text = content;

        obj.transform.findChildRecursively("UIManager").GetComponent <UIElement>().Show(true);
    }
예제 #2
0
 /// <summary>
 /// returns a string to display on ui
 /// </summary>
 /// /// <param name="id2name">convert class object id to name if possible</param>
 /// <returns>string</returns>
 public string getDisplayString(bool id2name = false)
 {
     if (dataType >= FBDataType.Class1)
     {
         if (id2name)
         {
             // try to return object name instead of id
             FBClassData   classData   = FBGameData.instance.getClassData((int)dataType);
             FBClassObject classObject = classData.getObject(intValue);
             if (classObject == null)
             {
                 return(intValue.ToString());
             }
             FBValue val = classObject.getFieldValue("Name");
             if (val != null)
             {
                 return(val.stringValue);
             }
             val = classObject.getFieldValue("name");
             if (val != null)
             {
                 return(val.stringValue);
             }
         }
         return(intValue.ToString());
     }
     if (dataType == FBDataType.Int)
     {
         return(intValue.ToString());
     }
     if (dataType == FBDataType.Float)
     {
         return(floatValue.ToString());
     }
     return(stringValue);
 }