//切换摄像机模式的UIButton public void ChangeCameraMode() { //切换模式 SystemValues.ChangeCameraMode(); //更换图片 ShowUI(); }
/// <summary> ///按钮方法,进行读档 /// </summary> private void MakeLoad(int ID) { bool loadOp = SystemValues.LoadInformation(ID.ToString()); string show = loadOp ? "读取成功" : "读取失败"; UIController.GetInstance().ShowUI <messageBox> (show); }
private void CreateBoss() { GameObject boss = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("Boss/Boss1")); boss.transform.position = SystemValues.thePlayer.transform.position + SystemValues.thePlayer.transform.forward.normalized * 5f; boss.GetComponent <monsterBoss> ().StartBoss(); //Debug.Log("create boss"); }
public Image theTalkHeadPicture; //头像 public override void OnShow(string value = "") { UIController.GetInstance().CloseUI <PlayerActCanvas>(); //对话的时候不可以操作 UIController.GetInstance().CloseUI <HpBasicPanel>(); //基本生命值界面也关闭 LoadTexts(value); //加载对话内容 ShowText(); //加载第一句话 SystemValues.theCamera.OnIntoPlot(); SystemValues.CloseBloodCanvas(); }
/// <summary> /// 开启选项进行选择. /// </summary> /// <param name="use">Use.</param> private void makeSelect(DialogFrame use) { theInformationText.text = "怎么选择呢?"; theNameText.text = ""; use.picture = "noOne"; Texture2D theTextureIn = SystemValues.LoadResources <Texture2D> ("TalkPicture/" + use.picture); UIController.GetInstance().ShowUI <UITalkSelect> (use.information); }
void searchAIMs() //不使用射线而是使用向量计算方法 { searchTimer -= Time.deltaTime; if (searchTimer < 0) { searchTimer = searchTimerMax; theEMYGet = SystemValues.searchAIMs(theViewAreaAngel, theSearchLength, this.theMoveController.transform); theMainEMY = getMainEMY(); } }
/// <summary> /// 正常的对话. /// </summary> /// <param name="use">Use.</param> private void makeTalk(DialogFrame use) { theNameText.text = use.name; theInformationText.text = use.information; use.picture = !string.IsNullOrEmpty(use.picture) ? use.picture : "noOne"; Texture2D theTextureIn = SystemValues.LoadResources <Texture2D> ("TalkPicture/" + use.picture); //Resources.Load <Texture2D> ("TalkPicture/" + use.picture); Sprite theSprite = Sprite.Create(theTextureIn, new Rect(0, 0, theTextureIn.width, theTextureIn.height), new Vector2(0, 0)); theTalkHeadPicture.sprite = theSprite; }
/// <summary> /// 按钮方法:进行存档 /// </summary> private void MakeSave(int ID) { bool saveOp = SystemValues.SaveInformation(ID.ToString()); StartCoroutine(OnScreenCapture2(ID)); string show = saveOp ? "存档成功" : "存档失败"; UIController.GetInstance().ShowUI <messageBox> (show); //loadButtonInformation ();全体刷新经过多次IO,不是好方法 loadButtonInformationFromMemory(ID); //假装先存档完成 }
private void skipScene() { if (SystemValues.getPlotID() >= minMainPlotID) { SystemValues.SaveCatch(); Destroy(this); UIController.GetInstance().ShowUI <UILoading> (aimScene); } else { UIController.GetInstance().ShowUI <messageBox> ("目前此处无法通行"); } }
/// <summary> ///额外方法,创建头顶血条 /// </summary> public virtual void MakeHpSlider() { GameObject theSlider = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("UI/PlayerBloodCanvas")); theSlider.transform.position = this.transform.position + new Vector3(0f, 1.5f, 0f); theSlider.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); theSlider.transform.SetParent(this.transform); PlayerBloodCanvas theShowCanvas = theSlider.GetComponent <PlayerBloodCanvas> (); theShowCanvas.MakeFkash(this); this.theBloodSlider = theShowCanvas; }
//最开始的设定 //设定完成之后自动销毁 void Start() { GameObject playerData = SystemValues.LoadResources <GameObject>("Player/ThePlayer"); thePlayer = (GameObject)GameObject.Instantiate(playerData); SystemValues.thePlayer = thePlayer; if (SystemValues.theSaveData == null) { thePlayer.transform.position = theStartPosition.position; } Invoke("makeStart", 0.05f); }
public static BloodChangeTextCanvas GetText() { bloodtexts.RemoveAll(X => X == null); if (bloodtexts.Count > 0) { BloodChangeTextCanvas aTextCanvas = bloodtexts [0]; bloodtexts.Remove(aTextCanvas); return(aTextCanvas); } BloodChangeTextCanvas newOne = Instantiate(SystemValues.LoadResources <GameObject>("UI/BloodChangeTextCanvas")).GetComponent <BloodChangeTextCanvas>(); return(newOne); }
//boss被打倒是需要串剧情的 public override void OnDead() { base.OnDead(); string plotName = SystemValues.getPlotName(PlotType, PlotID); //print (plotName +"---"); if (string.IsNullOrEmpty(plotName)) { return; } Destroy(this.theBossWall); UIController.GetInstance().ShowUI <TalkCanvas> (plotName); }
void makeStart() { if (SystemValues.theSaveData != null) { SystemValues.makeTrueLoad(); } else if (SystemValues.theDataCatch != null) { SystemValues.LoadCatch(); } loadGameInformation(); loadSetting(); ShowStartTalk(); Destroy(this); }
private void ShowPlot() { string plotName = SystemValues.getPlotName(PlotType, PlotID); //print (plotName +"---"); if (string.IsNullOrEmpty(plotName)) { return; } UIController.GetInstance().ShowUI <TalkCanvas> (plotName); if (isAutoDestroy) { Destroy(this.gameObject); } }
void ShowStartTalk() { if (PlotType < 0 || PlotID < 0) { return; } string plotName = SystemValues.getPlotName(PlotType, PlotID); //如果是读档的话,这个部分无果已经被读到,就可以直接跳过了 if (string.IsNullOrEmpty(plotName)) { return; } UIController.GetInstance().ShowUI <TalkCanvas> (plotName); }
public T GetUI <T>() where T : UIBasic { string UIName = typeof(T).ToString(); GameObject theUI; if (!UIBook.TryGetValue(UIName, out theUI)) { theUI = SystemValues.LoadResources <GameObject>("UI/" + UIName); theUI = Instantiate(theUI); theUI.name = UIName; UIBook.Add(UIName, theUI); } if (theUI) { return(theUI.GetComponent <T>()); } return(null); }
public void CloseUI <T> () where T : UIBasic { string UIName = typeof(T).ToString(); GameObject theUI; if (!UIBook.TryGetValue(UIName, out theUI)) { theUI = SystemValues.LoadResources <GameObject>("UI/" + UIName); theUI = Instantiate(theUI); theUI.name = UIName; UIBook.Add(UIName, theUI); } if (theUI) { theUI.GetComponent <T> ().OnEndShow(); theUI.SetActive(false); } }
public override void OnMissionOver() { if (!this.thePlayer) { this.thePlayer = SystemValues.thePlayer.GetComponent <Player> (); } this.thePlayer.theMissionPackage.theMissions.Remove(this); this.thePlayer.OnGetLearningValue(80f); UIController.GetInstance().ShowUI <messageBox> ("任务完成,获得80经验"); string plotName = SystemValues.getPlotName(0, 5); if (string.IsNullOrEmpty(plotName)) { return; } UIController.GetInstance().ShowUI <TalkCanvas> (plotName); }
private void LoadTexts(string value) { //print ("value =" +value); theFrames = new Queue <DialogFrame> (); TextAsset textAsset = SystemValues.LoadResources <TextAsset>("XML/" + value); xml.LoadXml(textAsset.text); theXmlList = xml.SelectNodes("Root/Dialog"); foreach (XmlNode node in theXmlList) { DialogFrame aFrame = new DialogFrame(); //print (node.SelectSingleNode("Name").InnerText); //print (node.SelectSingleNode("Picture").InnerText); //print (node.SelectSingleNode("Information").InnerText); aFrame.name = node.SelectSingleNode("Name").InnerText; aFrame.picture = node.SelectSingleNode("Picture").InnerText; aFrame.information = node.SelectSingleNode("Information").InnerText; theFrames.Enqueue(aFrame); } }
/// <summary> /// 摄像机的鼠标操作 /// </summary> private void CameraOperate() { if (!theTarget) { canOperate = true; FixedPostion(); canOperate = false; } if (!theTarget) { return; } if (Input.GetMouseButtonDown(0)) { if (SystemValues.IsOperatingUI()) { canOperate = false; } else { mousePosition = Input.mousePosition; canOperate = true; } } if (Input.GetMouseButton(0)) { if (canOperate) { float xMove = (Input.mousePosition.x - mousePosition.x); float yMove = (Input.mousePosition.y - mousePosition.y); Vector2 mouseControl = new Vector2(xMove, yMove); MoveWithVector(mouseControl); mousePosition = Input.mousePosition; } } if (Input.GetMouseButtonUp(0)) { canOperate = false; } }
/// <summary> /// 第一次生成UI,之后开/关UI /// </summary> public void ChangeUIState <T> ( ) where T : UIBasic { string UIName = typeof(T).ToString(); GameObject theUI; if (!UIBook.TryGetValue(UIName, out theUI)) { theUI = SystemValues.LoadResources <GameObject>("UI/" + UIName); theUI = Instantiate(theUI); theUI.name = UIName; UIBook.Add(UIName, theUI); if (theUI) { theUI.SetActive(false); } } if (theUI) { theUI.SetActive(!theUI.gameObject.activeInHierarchy); } }
/// <summary> /// 整体获取存档信息的方法 /// 这个方法只适合在初始化的时候使用 /// </summary> private void loadButtonInformation() { StartCoroutine(loadPicture()); for (int i = 0; i < 3; i++) { //加载存档信息 GameData theData = SystemValues.getData(i.ToString()); if (theData == null) { continue; } saveButtonTexts [i].text = "Lv." + theData.playerLv; //加载修改时间 string checkPath = Application.persistentDataPath + "/save" + i + ".jpg"; FileInfo fi = new FileInfo(checkPath); if (saveButtonTimeText[i]) { saveButtonTimeText[i].text = fi.LastWriteTime.ToString(); } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Z)) { SystemValues.SaveInformation(); } if (Input.GetKeyDown(KeyCode.X)) { SystemValues.LoadInformation("0"); } if (Input.GetKeyDown(KeyCode.V)) { Mission_KillMonster1 A = new Mission_KillMonster1(); A.MakeStart(); SystemValues.thePlayer.GetComponent <Player> ().theMissionPackage.AddNewMission(A); } if (Input.GetKeyDown(KeyCode.B)) { UIController.GetInstance().ShowUI <UIMissionCanvas> (); } }
//----------------------------------------------------操作方法封装,获得输入------------------------------------------------------------------------------// /// <summary> /// 摄像机的触摸操作 /// 进化版,可以检测多个手指的移动 /// </summary> private void CameraOperateTouch() { if (!theTarget) { return; } if (!SystemValues.IsOperatingUI() && Input.touches.Length == 1) { canOperate = true; Touch theTouch = Input.GetTouch(0); Vector2 touchControlVector = new Vector2(theTouch.deltaPosition.x, theTouch.deltaPosition.y); MoveWithVector(touchControlVector); } else if (Input.touches.Length == 2) { Touch theTouch; if (SystemValues.IsOperatingUI() && !SystemValues.IsOperatingUI(Input.GetTouch(1).fingerId)) { canOperate = true; theTouch = Input.GetTouch(1); Vector2 touchControlVector = new Vector2(theTouch.deltaPosition.x, theTouch.deltaPosition.y); MoveWithVector(touchControlVector); } if (!SystemValues.IsOperatingUI() && SystemValues.IsOperatingUI(Input.GetTouch(1).fingerId)) { canOperate = true; theTouch = Input.GetTouch(0); Vector2 touchControlVector = new Vector2(theTouch.deltaPosition.x, theTouch.deltaPosition.y); MoveWithVector(touchControlVector); } } else { canOperate = false; } }
public async Task <bool> CreateDataBase(string newOwner = null) { try { var res = await SystemValues.GetAllAsync(); if (!res.IsValid) { return(await Task.FromResult <bool>(false)); } if (!string.IsNullOrEmpty(newOwner)) { var resGetU = await Users.GetByUserNameAsync("owner"); if (resGetU.IsValid) { resGetU.Entity.UserName = newOwner; var resUpdateU = await Users.SaveAsync(resGetU.Entity); if (!resUpdateU.IsValid) { return(await Task.FromResult <bool>(false)); } } else { return(await Task.FromResult <bool>(false)); } } } catch (Exception) { return(await Task.FromResult <bool>(false)); } return(await Task.FromResult <bool>(true)); }
//刷新历史信息 public void MakeAllStart() { SystemValues.MakeAllStartFlash(); }
private void MakeBossWall() { theBossWall = GameObject.Instantiate(SystemValues.LoadResources <GameObject>("Boss/BossWall")); theBossWall.transform.position = this.transform.position; }