void onClose(GameObject go) { m_HouseMenu.SetActive(false); m_CameraMap.GetComponent <CameraDragMove>().enabled = true; m_CameraMap.GetComponent <ScalingMap>().enabled = true; GlobalVar.GetInstance().BuildObjname = null; }
public bool AddTargetShip(ShipBase ship) { if (m_targetShipList.Count > GlobalVar.GetInstance().GetMaxShips()) { return(false); } m_targetShipList.Add(ship); return(true); }
void MyTimer() { long DTdiff = DateTime.Now.Ticks - Dt.Ticks; //Debug.Log("DTdiff " + DTdiff); long DTnow = Stime - Convert.ToInt32(DTdiff / 10000000); //Debug.Log("DTnow " + DTnow); TimeCount(DTnow); m_ProgressBar.GetComponent <UISprite>().fillAmount = (1f / Stime) * (Stime - DTnow); if (DTnow < Stime / 3 * 2) { m_AnimationList[0].SetActive(false); m_AnimationList[1].SetActive(true); } if (DTnow < Stime / 3) { m_AnimationList[1].SetActive(false); m_AnimationList[2].SetActive(true); } if (DTnow <= 0) { GlobalVar.GetInstance().ceshi = m_MyItem[m_MyBB[ID].ItemID].Atlas; //建造结束初始化数据记录 m_ProgressBar.GetComponent <UISprite>().fillAmount = 0; //进度条归零 GlobalVar.GetInstance().BuildQueues = 0; //清空升级列表 GlobalVar.GetInstance().BuildObjname = null; //当前建造建筑对象归零 //为建造完成的建筑加载建筑数据 UIAtlas Ua = Resources.Load("Atlas/House/" + m_MyBB[ID].Atlas, typeof(UIAtlas)) as UIAtlas; m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_House.GetComponent <UISprite>().atlas = Ua; //图集 m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_House.GetComponent <UISprite>().spriteName = m_MyBB[ID].Icon; //图标 m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_BId.GetComponent <UILabel>().text = ID.ToString(); //建筑ID m_BuildingUpgraed.transform.parent.FindChild("BUManager").FindChild("HName").GetComponent <UILabel>().text = m_MyBB[ID].Name; //建筑名称 m_BuildingUpgraed.transform.parent.FindChild("BUManager").GetComponent <Upgrade>().m_HLev.GetComponent <UILabel>().text = m_MyBB[ID].Lv.ToString(); //建筑等级 //为建造完成的建筑加载产出数据 UIAtlas Uia = Resources.Load("Atlas/Lobby/" + m_MyItem[m_MyBB[ID].ItemID].Atlas, typeof(UIAtlas)) as UIAtlas; m_BuildingUpgraed.transform.parent.FindChild("Items").FindChild("2").GetComponent <UISprite>().atlas = Uia; m_BuildingUpgraed.transform.parent.FindChild("Items").FindChild("2").GetComponent <UISprite>().spriteName = m_MyItem[m_MyBB[ID].ItemID].Icon; m_BuildingUpgraed.transform.parent.FindChild("Items").FindChild("ItemID").GetComponent <UILabel>().text = m_MyBB[ID].ItemID.ToString();//产物ID m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_House.SetActive(true); //启动产物生产脚本 m_BuildingUpgraed.transform.parent.GetComponent <ItemTimer>().enabled = true; //关闭建造脚本 m_BuildingUpgraed.GetComponent <BuildTimer>().enabled = false; //弹出建造成功提示框 string WarningStr = "恭喜岛主" + m_MyBB[ID].Name + " 已经顺利建成!!"; warning Warning = new warning(WarningStr); //销毁建造perfab Destroy(m_BuildingUpgraed); } }
void onClose(GameObject go) { if (GlobalVar.GetInstance().Sw == false) { //Debug.Log("现在由Warning自己打开拖动与缩放!"); m_warning.GetComponent <warning>().m_CameraMap.GetComponent <CameraDragMove>().enabled = true; m_warning.GetComponent <warning>().m_CameraMap.GetComponent <ScalingMap>().enabled = true; GlobalVar.GetInstance().Sw = true; } Destroy(m_warning); }
void onUpgrade(GameObject go) { int Ind = Convert.ToInt32(m_BId.GetComponent <UILabel>().text); if (GlobalVar.GetInstance().UpgradeQueues == 0) { if (m_MyBB[Ind].Lv < m_MyBB[Ind].MxaLv) { //现有资源数量 int Item0 = Convert.ToInt32(m_ResList[0].GetComponentInChildren <UILabel>().text); int Item1 = Convert.ToInt32(m_ResList[m_MyBB[Ind].NeedID1].text); int Item2 = Convert.ToInt32(m_ResList[m_MyBB[Ind].NeedID2].text); int Item3 = Convert.ToInt32(m_ResList[m_MyBB[Ind].NeedID3].text); if (m_MyBB[Ind].Cost < Item0 && m_MyBB[Ind].Count1 < Item1 && m_MyBB[Ind].Count2 < Item2 && m_MyBB[Ind].Count3 < Item3) { m_ResList[0].GetComponentInChildren <UILabel>().text = (Item0 - m_MyBB[Ind].Cost).ToString(); m_ResList[m_MyBB[Ind].NeedID1].text = (Item1 - m_MyBB[Ind].Count1).ToString(); m_ResList[m_MyBB[Ind].NeedID2].text = (Item2 - m_MyBB[Ind].Count2).ToString(); m_ResList[m_MyBB[Ind].NeedID3].text = (Item3 - m_MyBB[Ind].Count3).ToString(); //保值 GlobalVar.GetInstance().UpgradeStartTime = DateTime.Now; GlobalVar.GetInstance().UpgradeID = Convert.ToInt32(m_BId.GetComponent <UILabel>().text); GlobalVar.GetInstance().UpgradeQueues = 1; GlobalVar.GetInstance().UpgradeTime = m_MyBB[Ind].UpgradeTime; m_UpgradeManager.SetActive(false); m_House.SetActive(false); m_House.GetComponent <TweenColor>().enabled = false; m_House.GetComponent <TweenColor>().ResetToBeginning(); UpgradeTimer Ui = new UpgradeTimer(m_BObj.name); //派遣装修队 } else { string str = "岛主,金币不足目前无法对目标建筑进行升级!!"; warning warning = new warning(str); } } else { string str = "岛主,当前建筑已升级到最高等级了!!"; warning warning = new warning(str); } } else { string Str = "岛主,当前没有闲置的装修队,所以无法进行装修!"; warning Warning = new warning(Str); } }
void onCABUB(GameObject go) { Debug.Log("你在点击地图!"); int ListCount = m_CloseBM.transform.GetComponent <BuildingManager>().m_BuildingList.Count; for (int i = 0; i < ListCount; i++) { m_CloseBM.transform.GetComponent <BuildingManager>().m_BuildingList[i].GetComponent <Building>().m_BUManager.SetActive(false); m_CloseBM.transform.GetComponent <BuildingManager>().m_BuildingList[i].GetComponent <Building>().m_House.GetComponent <TweenColor>().ResetToBeginning(); m_CloseBM.transform.GetComponent <BuildingManager>().m_BuildingList[i].GetComponent <Building>().m_House.GetComponent <TweenColor>().enabled = false; m_CloseBM.transform.GetComponent <BuildingManager>().m_BuildingList[i].GetComponent <Building>().m_Items.transform.localPosition = new Vector3(18f, 93f, 0); GlobalVar.GetInstance().UpObjname = null; } }
// Update is called once per frame void Update() { LL[0].text = "升级地标索引:" + GlobalVar.GetInstance().UpObjname; LL[1].text = "升级队列:" + GlobalVar.GetInstance().UpgradeQueues; LL[2].text = "升级的ID:" + GlobalVar.GetInstance().UpgradeID; LL[3].text = "升级耗时:" + GlobalVar.GetInstance().UpgradeTime; //LL[4].text = //LL[5].text = //LL[6].text = LL[7].text = "建造地标索引:" + GlobalVar.GetInstance().BuildObjname; LL[8].text = "建造队列:" + GlobalVar.GetInstance().BuildQueues; LL[9].text = "建造的ID:" + GlobalVar.GetInstance().BuildID; LL[10].text = "建造耗时:" + GlobalVar.GetInstance().BuildTime; //LL[11].text = //LL[12].text = LL[13].text = GlobalVar.GetInstance().ceshi; }
void onSale(GameObject go) { if (GlobalVar.GetInstance().UpObjname != null) { Transform Tf = m_BObj.transform.parent.Find(GlobalVar.GetInstance().UpObjname); Debug.Log("Tf名字 = " + Tf.name); Tf.GetComponent <Building>().m_BUManager.SetActive(false); Tf.GetComponent <Building>().m_Items.transform.localPosition = new Vector3(18f, 93f, 0); Tf.GetComponent <Building>().m_House.GetComponent <TweenColor>().enabled = false; Tf.GetComponent <Building>().m_House.GetComponent <TweenColor>().ResetToBeginning(); GlobalVar.GetInstance().UpObjname = null; } m_HouseMenu.SetActive(true); m_CameraMap.GetComponent <CameraDragMove>().enabled = false; m_CameraMap.GetComponent <ScalingMap>().enabled = false; GlobalVar.GetInstance().BuildObjname = m_BObj.name; }
void onBuyBut(GameObject go) { GlobalVar.GetInstance().BuildTime = m_MyBB[Ind].UpgradeTime; if (GlobalVar.GetInstance().BuildQueues == 0) { //现有资源数量 int Item0 = Convert.ToInt32(m_ResList[0].GetComponentInChildren<UILabel>().text); int Item1 = Convert.ToInt32(m_ResList[m_MyBB[Ind].NeedID1].GetComponentInChildren<UILabel>().text); int Item2 = Convert.ToInt32(m_ResList[m_MyBB[Ind].NeedID2].GetComponentInChildren<UILabel>().text); int Item3 = Convert.ToInt32(m_ResList[m_MyBB[Ind].NeedID3].GetComponentInChildren<UILabel>().text); if (m_MyBB[Ind].Cost < Item0 && m_MyBB[Ind].Count1 < Item1 && m_MyBB[Ind].Count2 < Item2 && m_MyBB[Ind].Count3 < Item3) { m_ResList[0].GetComponentInChildren<UILabel>().text = (Item0 - m_MyBB[Ind].Cost).ToString(); m_ResList[m_MyBB[Ind].NeedID1].GetComponentInChildren<UILabel>().text = (Item1 - m_MyBB[Ind].Count1).ToString(); m_ResList[m_MyBB[Ind].NeedID2].GetComponentInChildren<UILabel>().text = (Item2 - m_MyBB[Ind].Count2).ToString(); m_ResList[m_MyBB[Ind].NeedID3].GetComponentInChildren<UILabel>().text = (Item3 - m_MyBB[Ind].Count3).ToString(); //保值 GlobalVar.GetInstance().BuildStartTime = DateTime.Now; GlobalVar.GetInstance().BuildID = Convert.ToInt32(m_BId.GetComponent<UILabel>().text); GlobalVar.GetInstance().BuildQueues = 1; m_HouseMenu.SetActive(false); m_CameraMap.GetComponent<CameraDragMove>().enabled = true; m_CameraMap.GetComponent<ScalingMap>().enabled = true; BuildTimer UI = new BuildTimer(GlobalVar.GetInstance().BuildObjname); //派遣建造队 } else { string str = "岛主,金币不足目前无法对目标建筑进行升级!!"; warning warning = new warning(str); } } else { string Str = "岛主,当前没有闲置的建造队,所以无法进行装修!"; warning Warning = new warning(Str); } }
public warning(string WarningString) { GameObject Obj = Instantiate(Resources.Load("Prefab/Warning/Warning350")) as GameObject;//get perfab; Obj.transform.parent = GameObject.Find("UI").transform; Obj.transform.localScale = Vector3.one; Transform Tf = Obj.transform.parent.FindChild("Warning350(Clone)"); Tf.GetComponent <warning>().m_CameraMap = Obj.transform.parent.GetComponent <UIList>().m_CameraMap; Tf.FindChild("WarningString").GetComponent <UILabel>().text = WarningString; if (Tf.GetComponent <warning>().m_CameraMap.GetComponent <CameraDragMove>().enabled) { Debug.Log("拖动与缩放还没有关闭,现在由Warning自己关闭!"); Tf.GetComponent <warning>().m_CameraMap.GetComponent <CameraDragMove>().enabled = false; Tf.GetComponent <warning>().m_CameraMap.GetComponent <ScalingMap>().enabled = false; GlobalVar.GetInstance().Sw = false; } }
void onHouse(GameObject go) { if (GlobalVar.GetInstance().UpObjname == null) { //Debug.Log("第一次点击建筑,打开自己!"); m_BUManager.SetActive(true); m_House.GetComponent <TweenColor>().enabled = true; m_BUManager.GetComponent <Upgrade>().enabled = true; m_Items.transform.localPosition = new Vector3(78f, 93f, 0); GlobalVar.GetInstance().UpObjname = m_BObj.name; } else { if (GlobalVar.GetInstance().UpObjname == m_BObj.name) { //Debug.Log("关闭自己!"); m_BUManager.SetActive(false); m_House.GetComponent <TweenColor>().enabled = false; m_House.GetComponent <TweenColor>().ResetToBeginning(); m_BUManager.GetComponent <Upgrade>().enabled = false; m_Items.transform.localPosition = new Vector3(18f, 93f, 0); GlobalVar.GetInstance().UpObjname = null; } else { m_BUManager.SetActive(true); m_House.GetComponent <TweenColor>().enabled = true; m_BUManager.GetComponent <Upgrade>().enabled = true; m_Items.transform.localPosition = new Vector3(78f, 93f, 0); Transform Tf = m_BObj.transform.parent.FindChild(GlobalVar.GetInstance().UpObjname); Tf.GetComponent <Building>().m_BUManager.SetActive(false); Tf.GetComponent <Building>().m_House.GetComponent <TweenColor>().enabled = false; Tf.GetComponent <Building>().m_House.GetComponent <TweenColor>().ResetToBeginning(); Tf.GetComponent <Building>().m_BUManager.GetComponent <Upgrade>().enabled = true; Tf.GetComponent <Building>().m_Items.transform.localPosition = new Vector3(18f, 93f, 0); GlobalVar.GetInstance().UpObjname = m_BObj.name; } } }
// Use this for initialization void Start() { Debug.Log("开始升级!!!!!!"); m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_Sale.SetActive(false); m_MyBB = MyApp.GetInstance().GetDataManager().BB(); ID = GlobalVar.GetInstance().UpgradeID; Dt = GlobalVar.GetInstance().UpgradeStartTime; Stime = m_MyBB[ID].UpgradeTime; GlobalVar.GetInstance().ceshi = ID.ToString(); TimeCount(Stime); if (Stime > 0) { m_AnimationList[0].SetActive(true); } //点击动画显示建筑当前简略信息 for (int i = 0; i < m_AnimationList.Count; i++) { UIEventListener.Get(m_AnimationList[i]).onClick = onAnimation; } }
void MyTimer() { long DTdiff = DateTime.Now.Ticks - Dt.Ticks; //GlobalVar.GetInstance().BuildStartTime.Ticks; long DTnow = Stime - Convert.ToInt32(DTdiff / 10000000); TimeCount(DTnow); m_ProgressBar.GetComponent <UISprite>().fillAmount = (1f / Stime) * (Stime - DTnow); if (DTnow < Stime / 3 * 2) { m_AnimationList[0].SetActive(false); m_AnimationList[1].SetActive(true); } if (DTnow < Stime / 3) { m_AnimationList[1].SetActive(false); m_AnimationList[2].SetActive(true); } if (DTnow <= 0) { m_ProgressBar.GetComponent <UISprite>().fillAmount = 0; GlobalVar.GetInstance().UpgradeQueues = 0; //清空升级列表 m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_House.GetComponent <UISprite>().spriteName = m_MyBB[ID + 1].Icon; m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_BId.GetComponent <UILabel>().text = (ID + 1).ToString(); m_BuildingUpgraed.transform.parent.FindChild("BUManager").GetComponent <Upgrade>().m_HLev.GetComponent <UILabel>().text = m_MyBB[ID + 1].Lv.ToString(); string WarningStr = "恭喜岛主" + m_MyBB[ID + 1].Name + " 已经顺利升级到 " + m_MyBB[ID + 1].Lv + " 等级!"; warning Warning = new warning(WarningStr); m_BuildingUpgraed.transform.parent.GetComponent <Building>().m_House.SetActive(true); m_BuildingUpgraed.GetComponent <UpgradeTimer>().enabled = false; Destroy(m_BuildingUpgraed); } }