public void SetItemInfo(Bag item) { this.item = item; propInfo = PropConfig.getInstance().getPropInfoById((int)item.ItemId); if (propInfo == null) { Debug.LogError("道具信息错误"); } useBtn.gameObject.SetActive(propInfo.type == 1); uiItemIcon.sprite = CommonUtil.getSpriteByBundle("image_shop", propInfo.prop_id.ToString()); descTxt.text = propInfo.desc; }
public static void InitConfig() { Debug.Log("<color=green>Coo.InitConfig</color>"); PropConfig.Initialize(Coo.configManager.GetCustomConfig <PropConfigLoader>().propConfigs); Coo.configManager.GetConfig <int, ConstConfig>(); Coo.configManager.GetConfig <int, MsgData>(); Formula.LoadConfig(); Goo.avatar.LoadConfig(); War.model.LoadConfig(); Coo.configManager.GetConfig <int, PlotWarStartConf>(); Coo.configManager.GetConfig <string, PlotWarHeroConf>(); }
public override void ParseConfig(string xml) { _config = XmlConfigParser <PropConfig> .Load(xml); if (null == _config) { Logger.Error("invalid xml content"); return; } foreach (var item in _config.Items) { _configs[item.Id] = item; } }
void ReadConfig() { Coo.assetManager = AssetManager.Instance; Coo.configManager = ConfigManager.Instance; Coo.assetManager.Init(); PropConfig.Initialize(Coo.configManager.GetCustomConfig <PropConfigLoader>().propConfigs); Coo.configManager.GetConfig <int, ConstConfig>(); Goo.avatar.LoadConfig(); War.model.LoadConfig(); if (Application.isPlaying == false) { GameObject.DestroyImmediate(GameObject.Find("GameManagers")); } }
public void updateDropdowns() { PropPositioningInfo config = PropConfig.Instance().propPositioningDict[entityName]; for (int i = 0; i < NUM_DROPDOWNS; i++) { if (i < config.numSigns) { dropDownGroups[i].label.Show(); dropDownGroups[i].dropDown.Show(); } else { dropDownGroups[i].label.Hide(); dropDownGroups[i].dropDown.Hide(); } } }
public void Init() { // Debug.Log("soliderInitPropContainer " + legionData.legionId); // legionData.soliderInitPropContainer.Print(); subBattleForce = subBattleForce / PropConfig.GetInstance(PropId.AtkAdd).displayMultiplier; subProduceSpeed = subProduceSpeed / PropConfig.GetInstance(PropId.ProduceSpeedAdd).displayMultiplier; subMoveSpeed = subMoveSpeed / PropConfig.GetInstance(PropId.MoveSpeedAdd).displayMultiplier; displayIntBattleForce = intBattleForce - subBattleForce; displayIntProduceSpeed = intProduceSpeed - subProduceSpeed; displayIntMoveSpeed = intMoveSpeed - subMoveSpeed; soliderUnitData = new UnitData(); legionData.soliderInitPropContainer.UnitApp(soliderUnitData, true); buildUnitData = new UnitData(); // 势力--战前属性 buildUnitData.AppProps(legionData.buildInitAttachPropData, true); }
public async Task getAllData() { UINetLoadingComponent.showNetLoading(); try { await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/tips.json", TipsConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/prop.json", PropConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/zhuanpan.json", ZhuanPanConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/notice.json", NoticeConfig.getInstance().init); await HttpReqUtil.Req(NetConfig.getInstance().getWebUrl() + "files/friendRoomConfig.json", FriendRoomConfig.getInstance().init); //await SensitiveWordUtil.Req("http://fwdown.hy51v.com/online/file/stopwords.txt"); string data = CommonUtil.getTextFileByBundle("config", "stopwords"); SensitiveWordUtil.WordsDatas = data.Split(','); } catch (Exception ex) { Log.Error(ex); } UINetLoadingComponent.closeNetLoading(); }
static void setData(string reward) { GameObject obj = CommonUtil.getGameObjByBundle("uishowreward"); s_showObj = GameObject.Instantiate(obj, OtherData.s_commonCanvas.transform); s_showObj.transform.Find("Button_close").GetComponent <Button>().onClick.AddListener(() => { onClickClose(); }); // 出生动画 { s_showObj.transform.Find("content").localScale = new Vector3(0.7f, 0.7f, 0.7f); s_showObj.transform.Find("content").DOScale(1.0f, 0.2f); } List <string> list1 = new List <string>(); CommonUtil.splitStr(reward, list1, ';'); for (int i = 0; i < list1.Count; i++) { List <string> list2 = new List <string>(); CommonUtil.splitStr(list1[i], list2, ':'); int id = int.Parse(list2[0]); int num = int.Parse(list2[1]); PropInfo propInfo = PropConfig.getInstance().getPropInfoById(id); GameObject item = new GameObject(); item.transform.SetParent(s_showObj.transform.Find("content/Image_bg")); item.transform.localScale = new Vector3(1, 1, 1); // 图标 { Image icon = item.AddComponent <Image>(); // 话费 if (id == 3) { icon.sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "icon_huafei"); icon.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 80); } else { icon.sprite = CommonUtil.getSpriteByBundle("image_shop", propInfo.prop_id.ToString()); } } // 数量 { GameObject text_obj = new GameObject(); Text text = text_obj.AddComponent <Text>(); // 话费 if (id == 3) { text.text = "X" + (float)num / 100.0f; } else { text.text = "X" + num; } text.fontSize = 22; text.alignment = TextAnchor.MiddleCenter; text_obj.transform.SetParent(item.transform); text_obj.transform.localScale = new Vector3(1, 1, 1); text_obj.transform.localPosition = new Vector3(0, -65, 0); CommonUtil.SetTextFont(text_obj); } float x = CommonUtil.getPosX(list1.Count, 130, i, 0); item.transform.localPosition = new Vector3(x, 0, 0); } }
protected override void BeginOverlayImpl(RenderManager.CameraInfo cameraInfo) { if (refreshFlag) { refreshFlag = false; try { renderGameObjects(); } catch (Exception ex) { LoggerUtils.LogException(ex); } } if (!objHidden && cameraInfo.m_height > renderHeight) { foreach (ScreenObj screen in ScreenManager.instance.propDict.Values) { if (screen.signObject != null) { screen.signObject.SetActive(false); } } foreach (ScreenObj screen in ScreenManager.instance.buildingDict.Values) { if (screen.signObject != null) { screen.signObject.SetActive(false); } } objHidden = true; } else if (objHidden && cameraInfo.m_height <= renderHeight) //This is a mess, and I'll sort it soon :) { foreach (ScreenObj screen in ScreenManager.instance.propDict.Values) { if (screen.signObject != null) { screen.signObject.SetActive(true); } } foreach (ScreenObj screen in ScreenManager.instance.buildingDict.Values) { if (screen.signObject != null) { screen.signObject.SetActive(true); } } objHidden = false; } if (screenRefreshFlag) { screenRefreshFlag = false; List <Material> materials = TextureUtils.m_screenTextureStore.Values.ToList(); foreach (ScreenObj obj in ScreenManager.instance.buildingDict.Values) { if (obj.signObject) { PropPositioningInfo positioningInfo = PropConfig.Instance().propPositioningDict[obj.propName]; for (byte i = 0; i < positioningInfo.numSigns; i++) { Transform child = obj.signObject.transform.Find(i.ToString()); if (child != null && !obj.isStatic[i]) { Material mat = materials[messageRandom.Next(materials.Count)]; child.gameObject.GetComponent <MeshRenderer>().material = mat; } } } } foreach (ScreenObj obj in ScreenManager.instance.propDict.Values) { if (obj.signObject) { PropPositioningInfo positioningInfo = PropConfig.Instance().propPositioningDict[obj.propName]; for (byte i = 0; i < positioningInfo.numSigns; i++) { Transform child = obj.signObject.transform.Find(i.ToString()); if (child != null && !obj.isStatic[i]) { Material mat = materials[messageRandom.Next(materials.Count)]; child.gameObject.GetComponent <MeshRenderer>().material = mat; } } } } } }
private void renderGameObjects() { List <Material> materials = TextureUtils.m_screenTextureStore.Values.ToList(); foreach (KeyValuePair <ushort, ScreenObj> obj in ScreenManager.instance.propDict) { ScreenObj screenObj = obj.Value; if (screenObj.signObject != null) { continue; } else { screenObj.signObject = new GameObject(obj.Key + "animatedsign"); screenObj.signObject.transform.position = screenObj.position; screenObj.signObject.transform.Rotate(0, (screenObj.angle) + 60f, 0); PropPositioningInfo positioningInfo = PropConfig.Instance().propPositioningDict[screenObj.propName]; for (byte i = 0; i < positioningInfo.numSigns; i++) { if (screenObj.isActive[i]) { if (screenObj.isStatic[i] && !TextureUtils.m_screenTextureStore.ContainsKey(screenObj.staticImageString[i])) { continue; } GameObject screenPaneObj = new GameObject(i.ToString()); screenPaneObj.AddComponent <MeshRenderer>(); screenPaneObj.AddComponent <MeshFilter>(); screenPaneObj.transform.parent = screenObj.signObject.transform; screenPaneObj.transform.localPosition = new Vector3(positioningInfo.xPos[i], positioningInfo.yPos[i], positioningInfo.zPos[i]); screenPaneObj.transform.localScale = new Vector3(positioningInfo.xSize[i], positioningInfo.ySize[i], 1f); screenPaneObj.transform.Rotate(0, (screenObj.angle) + positioningInfo.rotations[i], 0); Material mat = screenObj.isStatic[i] ? TextureUtils.m_screenTextureStore[screenObj.staticImageString[i]] : materials[messageRandom.Next(materials.Count)]; screenPaneObj.GetComponent <Renderer>().material = mat; screenPaneObj.GetComponent <MeshFilter>().mesh = MeshUtils.CreateRectMesh(mat.mainTexture.width, mat.mainTexture.height); } } ScreenManager.instance.propDict[obj.Key].signObject = screenObj.signObject; } } foreach (KeyValuePair <ushort, ScreenObj> obj in ScreenManager.instance.buildingDict) { ScreenObj screenObj = obj.Value; if (screenObj.signObject != null) { continue; } else { screenObj.signObject = new GameObject(obj.Key + "animatedsign"); screenObj.signObject.transform.position = screenObj.position; screenObj.signObject.transform.Rotate(0, (screenObj.angle) + 60f, 0); PropPositioningInfo positioningInfo = PropConfig.Instance().propPositioningDict[screenObj.propName]; for (byte i = 0; i < positioningInfo.numSigns; i++) { if (screenObj.isActive[i]) { if (screenObj.isStatic[i] && !TextureUtils.m_screenTextureStore.ContainsKey(screenObj.staticImageString[i])) { continue; } GameObject screenPaneObj = new GameObject(i.ToString()); screenPaneObj.AddComponent <MeshRenderer>(); screenPaneObj.AddComponent <MeshFilter>(); screenPaneObj.transform.parent = screenObj.signObject.transform; screenPaneObj.transform.localPosition = new Vector3(positioningInfo.xPos[i], positioningInfo.yPos[i], positioningInfo.zPos[i]); screenPaneObj.transform.localScale = new Vector3(positioningInfo.xSize[i], positioningInfo.ySize[i], 1f); screenPaneObj.transform.Rotate(0, (screenObj.angle) + positioningInfo.rotations[i], 0); Material mat = screenObj.isStatic[i] ? TextureUtils.m_screenTextureStore[screenObj.staticImageString[i]] : materials[messageRandom.Next(materials.Count)]; screenPaneObj.GetComponent <Renderer>().material = mat; screenPaneObj.GetComponent <MeshFilter>().mesh = MeshUtils.CreateRectMesh(mat.mainTexture.width, mat.mainTexture.height); } } ScreenManager.instance.buildingDict[obj.Key].signObject = screenObj.signObject; } } }
protected override void OnToolUpdate() { if (m_toolController != null && !m_toolController.IsInsideUI && Cursor.visible) { RaycastOutput raycastOutput; if (RaycastProp(out raycastOutput)) { ushort propId = raycastOutput.m_propInstance; ushort buildingId = raycastOutput.m_building; if (propId != 0) { PropManager propManager = PropManager.instance; PropInstance prop = propManager.m_props.m_buffer[(int)propId]; if ((prop.m_flags & (ushort)(PropInstance.Flags.Created)) != (ushort)PropInstance.Flags.None && PropConfig.Instance().propPositioningDict.ContainsKey(prop.Info.GetLocalizedTitle())) { if (Event.current.type == EventType.MouseDown) { //unset tool ShowToolInfo(false, null, new Vector3()); dialog.isProp = true; dialog.entityId = propId; dialog.entityPosition = prop.Position; dialog.entityAngle = -1 * Mathf.Rad2Deg * prop.Angle; dialog.entityName = prop.Info.GetLocalizedTitle(); dialog.updateDropdowns(); dialog.Show(); ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>(); ToolsModifierControl.SetTool <DefaultTool>(); } else { ShowToolInfo(true, "Make this sign dynamic!", prop.Position); } } } else if (buildingId != 0) { BuildingManager buildingManager = BuildingManager.instance; Building building = buildingManager.m_buildings.m_buffer[buildingId]; UIPanel panel = GameObject.Find("(Library) CityServiceWorldInfoPanel").GetComponent <UIPanel>(); if ((building.m_flags & Building.Flags.Created) != Building.Flags.None && PropConfig.Instance().propPositioningDict.ContainsKey(building.Info.GetLocalizedTitle())) { Vector3 position; Quaternion rotation; building.CalculateMeshPosition(out position, out rotation); if (Event.current.type == EventType.MouseDown) { //unset tool ShowToolInfo(false, null, new Vector3()); panel.Hide(); dialog.isProp = false; dialog.entityId = buildingId; dialog.entityPosition = position; dialog.entityAngle = rotation.eulerAngles.y; dialog.entityName = building.Info.GetLocalizedTitle(); dialog.updateDropdowns(); dialog.Show(); //ScreenManager.instance.SetPropScreen(false, buildingId, position, rotation.eulerAngles.y, building.Info.GetLocalizedTitle()); ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>(); ToolsModifierControl.SetTool <DefaultTool>(); } else { ShowToolInfo(true, "Make this sign dynamic!", position); } } } else { ShowToolInfo(false, null, new Vector3()); } } else { ShowToolInfo(false, null, new Vector3()); } } else { ShowToolInfo(false, null, new Vector3()); } }