/// <summary> /// 初始化 /// </summary> void Awake() { // 获取动画播放对象 playAnim = gameObject.AddComponent <UIPlayAnimation>(); // 设置动画 playAnim.target = GetComponent <Animation>(); // 开始按钮 Transform start = transform.Find("Button - Start"); // 获取开始控制 对象 startButton = start.GetComponent <UIButton>(); // 获取开始按钮 文本对象 startLabel = start.Find("Label").GetComponent <UILocalize>(); // 重新开始按钮 restartButton = transform.Find("Button - ReStart").gameObject; // 背景 列表 backgroundList = transform.Find("Pop Up List - Background").GetComponent <UIPopupList>(); // 是否 显示原始图像 imageToggle = transform.Find("Check Box - Show Original Image").GetComponent <UIToggle>(); // 是否 旋转拼图 rotateToggle = transform.Find("Check Box - Rotate Piece").GetComponent <UIToggle>(); // 拼图个数 列表 countList = transform.Find("Pop Up List - Piece Count").GetComponent <UIPopupList>(); // 拼图图像 列表 imageList = transform.Find("Pop Up List - Piece Image").GetComponent <UIPopupList>(); // 拼图形状 列表 shapeList = transform.Find("Pop Up List - Piece Shape").GetComponent <UIPopupList>(); // 拼图风格 列表 styleList = transform.Find("Pop Up List - Piece Style").GetComponent <UIPopupList>(); // 是否显示所有拼图 按钮 showAllToggle = transform.Find("Toggle Button - Show All").GetComponent <UIToggle>(); // 平铺拼图 按钮 tileButton = transform.Find("Button - Tile Piece").GetComponent <UIButton>(); }
public static void ConvertNGUI_to_I2() { UILocalize[] locals = (UILocalize[])Resources.FindObjectsOfTypeAll(typeof(UILocalize)); for (int i = 0, imax = locals.Length; i < imax; ++i) { UILocalize local = locals[i]; GameObject GO = local.gameObject; if (!GUITools.ObjectExistInScene(GO)) { continue; } Localize NewLocal = GO.AddComponent <Localize>(); NewLocal.Term = local.key; Object.DestroyImmediate(local); } /* Localization[] NGUILocalizations = (Localization[])Resources.FindObjectsOfTypeAll(typeof(Localization)); * for (int i=0, imax=NGUILocalizations.Length; i<imax; ++i) * if (GUITools.ObjectExistInScene (NGUILocalizations[i].gameObject)) * { * Localization NGUILocalization = NGUILocalizations[i]; * LanguageSource I2Source = NGUILocalization.gameObject.AddComponent<LanguageSource>(); * * for (int j=0, jmax=NGUILocalization.languages.Length; j<jmax; ++j) * { * I2Source.AddLanguage( NGUILocalization.languages[j].name, string.Empty, NGUILocalization.languages[j] ); * } * * Object.DestroyImmediate( NGUILocalization ); * }*/ }
public override void Awake() { base.Awake(); _localize = GetComponent<UILocalize>(); isAwake = true; }
private static void Prefix(Panel_FirstAid __instance) { Transform airTempRow = __instance.m_AirTempLabel.transform.parent; Transform windChillRow = __instance.m_WindchillLabel.transform.parent; Transform feelsLikeRow = __instance.m_FeelsLikeLabel.transform.parent; GameObject storedCaloriesRow = NGUITools.AddChild(windChillRow.parent.gameObject, windChillRow.gameObject); storedCaloriesRow.name = "StoredCaloriesWarmthLabel"; UISprite icon = storedCaloriesRow.transform.Find("Stat Icon").GetComponent <UISprite>(); icon.spriteName = "ico_status_hunger4"; // old: ico_HUD_hunger, ico_Radial_food2 icon.transform.localPosition += new Vector3(-1, 0); // Tiny position nudge to center icon properly UILocalize nameLabel = storedCaloriesRow.transform.Find("Stat Label").GetComponent <UILocalize>(); //nameLabel.key = "GAMEPLAY_CalorieStore"; SetKey(nameLabel, "GAMEPLAY_CalorieStore"); const float basePos = 24; airTempRow.transform.localPosition = new Vector3(0, basePos, 0); windChillRow.transform.localPosition = new Vector3(0, basePos - 26, 0); storedCaloriesRow.transform.localPosition = new Vector3(0, basePos - 52, 0); feelsLikeRow.transform.localPosition -= new Vector3(0, 5, 0); }
public override void Awake() { base.Awake(); _localize = GetComponent <UILocalize>(); isAwake = true; }
public void LoadLevelUI(string name) { // Load template data JSONNode jo = TemplateMgr.Instance.GetTemplateString(ConfigKey.LevelInfo, name); // Load name string levelName = levelPlayModel.levelName; levelNameLabel.GetComponent <UILocalize>().key = "LK" + levelName + "Title"; levelNameLabel.SetActive(false); levelNameLabel.SetActive(true); // Load GameContainer _gameContainer = Instantiate(Resources.Load(PathContainer.ContainerPath + name + "Container")) as GameObject; _gameContainer.transform.parent = this.gameObject.transform; _gameContainer.transform.localPosition = Vector3.zero; _gameContainer.transform.localScale = new Vector3(1.3f, 1.3f, 1.0f); // Init gameContainer's component _labelLevelTitle = _gameContainer.transform.Find("Detail/LabelContainer/LabelName").gameObject.GetComponent <UILocalize>(); _labelLevelTitle.key = "LK" + levelName + "Title"; _labelLevelLatin = _gameContainer.transform.Find("Detail/LabelContainer/ContainerInfo/LabelLatin").gameObject.GetComponent <UILocalize>(); _labelLevelLatin.key = "LK" + levelName + "Latin"; _labelLevelSeason = _gameContainer.transform.Find("Detail/LabelContainer/ContainerInfo/LabelSeason").gameObject.GetComponent <UILocalize>(); _labelLevelSeason.key = jo["season"]; _labelLevelPosition = _gameContainer.transform.Find("Detail/LabelContainer/ContainerInfo/LabelPosition").gameObject.GetComponent <UILabel>(); _labelLevelPosition.text = jo["position"]; _labelLevelInfo = _gameContainer.transform.Find("Detail/LabelContainer/LabelInfo").gameObject.GetComponent <UILocalize>(); _labelLevelInfo.key = "LK" + levelName + "Info"; _lineContainer = GameObject.Find(_gameContainer.name + "/Sky/LineContainer"); labelCoin.text = levelPlayModel.GetCoin().ToString(); backButton.SetActive(true); labelNum.gameObject.SetActive(true); RefreshLabelNum(); }
public void OnSlecteLocalize(string key, string val) { UILocalize lz = target as UILocalize; lz.key = key; lz.value = val; }
private static void Postfix(Panel_Rest __instance) { Transform parentTransform = __instance.m_EstimatedCaloriesBurnedLabel.transform.parent; GameObject gameObject = parentTransform.Find("Label_CaloriesBurned").gameObject; UILocalize localize = gameObject.GetComponent <UILocalize>(); //localize.key = "GAMEPLAY_Hunger"; SetKey(localize, "GAMEPLAY_Hunger"); }
public Button(GameObject gameObject, UILabel uiLabel, UISprite uiSprite) { this.gameObject = gameObject; this.uiLabel = uiLabel; this.uiLocalize = uiLabel.GetComponent <UILocalize>(); this.uiSprite = uiSprite; }
public Button(GameObject obj) : base(obj) { GroupState = obj.GetExactComponent <ButtonGroupState>(); UiButton = obj.GetExactComponent <UIButton>(); UiLocalize = obj.GetExactComponent <UILocalize>(); UiLabel = obj.GetExactComponent <UILabel>(); UiEventListener = obj.EnsureExactComponent <UIEventListener>(); }
public override void Awake() { base.Awake(); _localize = GetComponent <UILocalize>(); if (_localize == null) { _localize = gameObject.AddComponent <UILocalize>(); } }
private void RecordLabelInfo(UILabel label) { UILabel labelItem = label; UILocalize localize = labelItem.GetComponent <UILocalize>() ?? labelItem.gameObject.AddComponent <UILocalize>(); string value = labelItem.text.Replace("\n", @"\\n");; string key = GetStringKeyInText(value); localize.key = key; }
static public int get_key(IntPtr l) { try { UILocalize self = (UILocalize)checkSelf(l); pushValue(l, true); pushValue(l, self.key); return(2); } catch (Exception e) { return(error(l, e)); } }
// Use this for initialization void Awake() { _lineContainer = null; _gameContainer = null; _labelLevelTitle = null; _labelLevelLatin = null; _labelLevelSeason = null; _labelLevelPosition = null; _labelLevelInfo = null; _lineTemplate = Resources.Load(PathContainer.LinkedLinePrefabPath) as GameObject; menu.SetActive(false); lastMenu.SetActive(false); }
private static void Postfix(Panel_SnowShelterInteract __instance) { UILocalize calorieStoreHeader = __instance.m_CurrentCaloriesLabel.GetComponent <UILocalize>(); //calorieStoreHeader.key = "GAMEPLAY_CalorieStore"; SetKey(calorieStoreHeader, "GAMEPLAY_CalorieStore"); Transform estimatedCaloriesHeader = __instance.m_EstimatedCaloriesBurnedLabel.transform.parent.Find("Header"); UILocalize localize = estimatedCaloriesHeader.GetComponent <UILocalize>(); //localize.key = "GAMEPLAY_Hunger"; SetKey(localize, "GAMEPLAY_Hunger"); }
void Awake() { labelTitle = this.gameObject.transform.Find("LabelTitle").gameObject.GetComponent <UILabel>(); labelName = this.gameObject.transform.Find("LabelName").gameObject.GetComponent <UILocalize>(); director = GameObject.Find("UI Root/GameDirector").GetComponent <GameDirector>(); GameObject controller = GameObject.Find("UI Root/GameController"); UIEventTrigger trigger = this.gameObject.GetComponent <UIEventTrigger>(); EventDelegate eventDel = new EventDelegate(controller.GetComponent <EventController>(), "OnClickCardInfo"); eventDel.parameters[0] = new EventDelegate.Parameter(this, "levelName"); trigger.onClick.Add(eventDel); }
static public int set_value(IntPtr l) { try { UILocalize self = (UILocalize)checkSelf(l); string v; checkType(l, 2, out v); self.value = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private static void SetLabelText(Transform transform, string text, bool localize) { if (localize) { UILocalize uiLocalize = transform.GetComponent <UILocalize>(); uiLocalize.key = text; } else { UnityEngine.Object.Destroy(transform.GetComponent <UILocalize>()); UILabel uiLabel = transform.GetComponent <UILabel>(); uiLabel.text = text; } }
public static UILocalize SetLocalization(this Text text, string key, string keyUnit, StringType type, params object[] args) { UILocalize uiLocalize = text.GetComponent <UILocalize>(); if (uiLocalize == null) { uiLocalize = text.gameObject.AddComponent <UILocalize>(); } uiLocalize.Set(key, keyUnit, type, args); return(uiLocalize); }
internal static void SetButtonLocalizationKey(UIButton button, string key) { if (button == null) { return; } bool wasActive = button.gameObject.activeSelf; button.gameObject.SetActive(false); UILocalize localize = button.GetComponentInChildren <UILocalize>(); if (localize != null) { localize.key = key; } button.gameObject.SetActive(wasActive); }
public override void LocalizeButtonText(string leftStrIDS, string rightStrIDS) { if (!string.IsNullOrEmpty(leftStrIDS)) { UILocalize localizeLeft = leftButtonLabel.gameObject.GetComponent <UILocalize>(); localizeLeft.key = leftStrIDS; localizeLeft.Localize(); } if (!string.IsNullOrEmpty(rightStrIDS)) { UILocalize localizeRight = rightButtonLabel.gameObject.GetComponent <UILocalize>(); localizeRight.key = rightStrIDS; localizeRight.Localize(); } }
private void initializeNameFromLocalizationKey() { //Debug.LogError("initializeNameFromLocalizationKey '"+itemName+"' starts"); bool previousState = gameObject.activeInHierarchy; gameObject.SetActive(true); UILocalize localize = gameObject.GetComponentInChildren <UILocalize>(); if (null == localize) { Logger.Log("no localize found", Logger.Level.WARN); itemName = gameObject.name; //Debug.LogError("no localize found, activeInHierarchy="+gameObject.activeInHierarchy+", activeSelf"+gameObject.activeSelf); } else { itemName = localize.key; } gameObject.SetActive(previousState); //Debug.LogError("initializeNameFromLocalizationKey '"+itemName+"' ends"); }
public static void ExecuteLocalize(UILocalize localize, string context) { if (localize == null) { return; } switch (localize.localizeType) { case UILocalizeType.Text: localize.SetText(context); break; case UILocalizeType.ImageLoad: UnityEngine.Sprite sprite = null; string[] paths = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName("icon.unity3d", context); if (paths == null || paths.Length <= 0) { UnityEngine.Debug.LogError($"{localize.gameObject.name}的语言表id填写错误,找不到对应的sprite资源"); } else { sprite = AssetDatabase.LoadAssetAtPath <UnityEngine.Sprite>(paths[0]); } localize.SetImage(sprite); break; case UILocalizeType.Font: UnityEngine.Font font = AssetDatabase.LoadAssetAtPath <UnityEngine.Font>(context); localize.SetFont(font); break; case UILocalizeType.Audio: UnityEngine.AudioClip audioClip = AssetDatabase.LoadAssetAtPath <UnityEngine.AudioClip>(context); localize.SetAudio(audioClip); break; default: break; } }
void OnEnable() { _target = target as UILocalize; }
public GOLocalizableLabel(GameObject obj) : base(obj) { Localize = obj.GetExactComponent <UILocalize>(); }
void Awake() { //Get necessary components at Awake() slider = GetComponentInChildren <UISlider>(); loc = GetComponentInChildren <UILocalize>(); }
public static void SetKey(UILocalize localize, string value) { il2cpp_gc_wbarrier_set_field(localize.Pointer, KeyAddr(localize), IL2CPP.ManagedStringToIl2Cpp(value)); }
private static IntPtr KeyAddr(UILocalize localize) { ulong ptr = (ulong)IL2CPP.Il2CppObjectBaseToPtrNotNull(localize) + IL2CPP.il2cpp_field_get_offset((IntPtr)AccessTools.Field(typeof(UILocalize), "NativeFieldInfoPtr_key").GetValue(null)); return((IntPtr)ptr); }
public UILocalizeMessage(UILocalize uiLocalize) : base(uiLocalize) { Key = uiLocalize.key; }
void Awake() { // Awake()에서 필요한 컴포넌트를 찾는다 slider = GetComponentInChildren <UISlider>(); loc = GetComponentInChildren <UILocalize>(); }