// Use this for initialization void Start() { inSight = false; warnship = player.GetComponent<warning> (); forceMagnitude = 50000000.0f; Power_distance = 2.5f; }
// Use this for initialization void Start() { inSight = false; warnship = player.GetComponent <warning> (); forceMagnitude = 50000000.0f; Power_distance = 2.5f; }
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 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 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); } }
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); } }