public void Init(ZhiboAudienceMgr audienceMgr) { this.audienceMgr = audienceMgr; this.rt = transform as RectTransform; view = new ZhiboLittleTvView(); BindView(); RegisterEvents(); pResLoader = GameMain.GetInstance().GetModule <ResLoader>(); audienceImage.Add(pResLoader.LoadResource <Sprite>("AudienceImage/" + "Normal")); audienceImage.Add(pResLoader.LoadResource <Sprite>("AudienceImage/" + "Heizi")); view.animator = GetComponent <Animator>(); view.animator.Play("Empty"); loadTimeLeftBlockImage(); //randomly choose bg // changeToNormalBg(); gameObject.SetActive(false); view.rootCG.alpha = 1; isAttracted = false; for (int i = 0; i < 5; i++) { view.TokenList[i].enabled = false; } //animator.ResetTrigger(""); }
public override void BindView() { //view.NextStage = root. view.InspectBtn = root.Find("Deck").GetComponent <Button>(); view.ScheduleBtn = root.Find("Schedule").GetComponent <Button>(); view.NextStage = root.Find("NextTurn").GetComponent <Button>(); view.PhoneBigPic = root.Find("PhoneMenu").GetComponent <Image>(); view.Close = view.PhoneBigPic.transform.Find("Close").GetComponent <Image>(); view.PhoneMiniIcon = root.Find("Phone_miniicon").GetComponent <Image>(); view.Properties = root.Find("Properties"); view.EventsContainer = root.Find("Events"); view.AppsContainer = view.PhoneBigPic.transform.Find("Apps"); foreach (AppInfo app in model.UnlockedApps) { GameObject go = pResLoader.Instantiate("UI/app", view.AppsContainer); AppView appView = new AppView(); appView.BindView(go.transform); appView.icon.sprite = pResLoader.LoadResource <Sprite>("Textures/" + app.AppId); appView.title.text = app.ShowName; view.appViews.Add(appView); } }
public void ShowItems() { int from = nowPage * PageFixItemNum; int to = Mathf.Min(nowPage * PageFixItemNum + 5, pTaobaoMgr.GetNumberOfProduct() - 1); //int to = Mathf.Min(nowPage * PageFixItemNum + 5,fakeList.Count-1); int idx = 0; for (int i = from; i <= to; i++) { //TaobaoItemInfo info = fakeList[i]; TaobaoItemInfo info = pTaobaoMgr.GetDetailItem(i); view.ItemList[idx].ItemName.text = info.Name; view.ItemList[idx].Price.text = info.Cost + " G"; view.ItemList[idx].Picture.sprite = pResLoader.LoadResource <Sprite>("TaobaoItemImages/" + info.Picture); Debug.Log(info.Picture); if (info.LeftInStock == 0) { view.ItemList[idx].SelloutMark.SetActive(true); view.ItemList[idx].InStock.text = "库存 " + info.LeftInStock; } else { view.ItemList[idx].SelloutMark.SetActive(false); view.ItemList[idx].InStock.text = "库存 " + info.LeftInStock; } view.ItemList[idx].root.gameObject.SetActive(true); idx++; } for (int i = idx; i < PageFixItemNum; i++) { view.ItemList[i].root.gameObject.SetActive(false); } }
public EmergencyAsset GetEmergencyAsset(string id) { if (EmergencyDict.ContainsKey(id)) { return(EmergencyDict[id]); } return(mResLoader.LoadResource <EmergencyAsset>("Emergencies/choufeng")); }
public SkillAsset LoadSkillAsset(string SkillId) { SkillAsset asset = mResLoader.LoadResource <SkillAsset>("Skills/SkillId"); if (asset != null) { SkillAssetDict.Add(SkillId, asset); } return(asset); }
public void UpdateActions() { for (int i = 0; i < FightingDanmuGameMode.ActionNum; i++) { OperatorView vv = view.Actions[i]; if (i >= gameMode.state.PresetActions.Count || gameMode.state.PresetActions[i] == null) { return; } vv.Title.text = gameMode.state.PresetActions[i].Name; vv.Picture.sprite = mResLoader.LoadResource <Sprite>("CardImage/" + gameMode.state.PresetActions[i].PictureUrl); } { if (gameMode.state.Passive != null) { OperatorView vv = view.Passive; vv.Title.text = gameMode.state.Passive.Name; vv.Picture.sprite = mResLoader.LoadResource <Sprite>("CardImage/" + gameMode.state.Passive.PictureUrl); } } }
public void switchSelectedStory(int idx) { if (nowIdx == idx) { return; } foreach (RoleItemView roleView in view.roleList) { roleView.chooseHint.enabled = false; } view.roleList [idx].chooseHint.enabled = true; //view.properies.SetPointValues (new int[]{Random.Range(10,20),Random.Range(10,20),Random.Range(10,20),Random.Range(10,20),Random.Range(10,20)}); nowIdx = idx; RoleStoryAsset ret = pResLoader.LoadResource <RoleStoryAsset> ("Roles/role" + idx); if (ret != null) { view.DetailName.text = ret.Name; view.DetailDesp.text = ""; foreach (string ss in ret.specialList) { view.DetailDesp.text += ss + "\n"; } view.InitMoney.text = ret.initMoney + ""; view.InitAttr.text = ret.initFreePoint + ""; view.InitSkill.text = ret.initSkillPoint + ""; view.properies.SetPointValues(ret.initProperties); for (int i = 0; i < view.extraInfoList.Count; i++) { pResLoader.ReleaseGO("UI/Role/extra", view.extraInfoList[i].root.gameObject); } view.extraInfoList.Clear(); for (int i = 0; i < ret.initOwning.Count; i++) { ExtraInfoView vv = new ExtraInfoView(); GameObject go = pResLoader.Instantiate("UI/Role/extra", view.extraContainer); vv.BindView(go.transform); view.extraInfoList.Add(vv); } } }
public void loadSkill2Asset() { SkillAsset2Collection newSkillCollection = mResLoader.LoadResource <SkillAsset2Collection>("SkillsNewType/SkillAsset2Collection"); //for(int i = 0; i<5; i++) //{ // for(int j = 0; j<5; j++) // { // SkillAsset2 asset = mResLoader.LoadResource<SkillAsset2>("SkillsNewType/Skills/") // } //} foreach (SkillAsset2List list in newSkillCollection.SkillCollection) { foreach (SkillAsset2 asset in list.SkillBranch) { SkillInfo2 assetInf = new SkillInfo2(); assetInf.SkillId = asset.SkillId; assetInf.SkillName = asset.SkillName; assetInf.Des = asset.SkingDesp; assetInf.EffectDes = asset.SkingEffectDesp; assetInf.Branch = asset.Branch; assetInf.Level = asset.Level; assetInf.Requirements = asset.Requirements; assetInf.Rewards = asset.Rewards; OwnedSkills.Add(assetInf); if (!SkillAssetDict.ContainsKey(assetInf.SkillId)) { SkillAssetDict[asset.SkillId] = assetInf; } if (!SkillBranchDict.ContainsKey(assetInf.Branch)) { SkillBranchDict[assetInf.Branch] = new Dictionary <int, string>(); } if (!SkillBranchDict[assetInf.Branch].ContainsKey(assetInf.Level)) { SkillBranchDict[assetInf.Branch][assetInf.Level] = assetInf.SkillId; } } } }
private void UpdateCards(List <CardInfo> infos) { foreach (CardOutView vv in view.CardsViewList) { pResLoader.ReleaseGO("UI/CardOut", vv.root.gameObject); } view.CardsViewList.Clear(); preCardView = null; model.NowCardInfos = infos; foreach (CardInfo c in infos) { GameObject go = pResLoader.Instantiate("UI/CardOut", view.CardsContainer); CardOutView cardOutView = new CardOutView(); cardOutView.BindView(go.transform); view.CardsViewList.Add(cardOutView); cardOutView.Hint.gameObject.SetActive(false); { ClickEventListerner listener = cardOutView.CardFace.gameObject.GetComponent <ClickEventListerner>(); if (listener == null) { listener = cardOutView.CardFace.gameObject.AddComponent <ClickEventListerner>(); } listener.ClearClickEvent(); listener.OnClickEvent += delegate { ShowCardDetail(cardOutView); }; } CardAsset ca = pCardMgr.GetCardInfo(c.CardId); cardOutView.Name.text = ca.CardName; cardOutView.Desp.text = ca.CardEffectDesp; cardOutView.Cost.text = ca.cost + ""; cardOutView.NamePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardName/" + ca.CatdImageName); switch (ca.CardType) { case eCardType.GENG: cardOutView.Cover.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Geng"); cardOutView.Bg.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Geng"); cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Geng"); Color nowColor1 = Color.white; ColorUtility.TryParseHtmlString(CostColor[2], out nowColor1); //color follow the type cardOutView.Cost.color = nowColor1; break; case eCardType.ABILITY: cardOutView.Cover.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Ability"); cardOutView.Bg.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Ability"); cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Ability"); Color nowColor2 = Color.white; ColorUtility.TryParseHtmlString(CostColor[1], out nowColor2); //color follow the type cardOutView.Cost.color = nowColor2; break; case eCardType.ITEM: cardOutView.Cover.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Item"); cardOutView.Bg.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Item"); cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Item"); Color nowColor3 = Color.white; ColorUtility.TryParseHtmlString(CostColor[0], out nowColor3); //color follow the type cardOutView.Cost.color = nowColor3; break; } cardOutView.DaGou.SetActive(!c.isDisabled); if (ca.CatdImageName == null || ca.CatdImageName == string.Empty) { cardOutView.Picture.sprite = ca.Picture; } else { cardOutView.Picture.sprite = pResLoader.LoadResource <Sprite>("CardImage/" + ca.CatdImageName); } //Debug.Log(ca.Picture.name); } }
public EmergencyAsset GetEmergencyAsset(string id) { return(mResLoader.LoadResource <EmergencyAsset>("Emergencies/choufeng")); }
public override void BindView() { //view.NextStage = root. view.InspectBtn = root.Find("Deck").GetComponent <Button>(); view.ScheduleBtn = root.Find("Schedule").GetComponent <Button>(); view.NextStage = root.Find("NextTurn").GetComponent <Button>(); view.FightDanmuBtn = root.Find("FightDanmuBtn").GetComponent <Button>(); view.XinqingSlider = root.Find("Property2").Find("Xintai").Find("Slider").GetComponent <Slider>(); view.FumianSlider = root.Find("Property2").Find("Fumian").Find("Slider").GetComponent <Slider>(); view.PhoneBigPic = root.Find("PhoneMenu").GetComponent <Image>(); view.Close = view.PhoneBigPic.transform.Find("Close").GetComponent <Image>(); view.PhoneMiniIcon = root.Find("Phone_miniicon").GetComponent <Image>(); view.MoneyShow = root.Find("Money").Find("Value").GetComponent <Text>(); view.SkillExpShow = root.Find("SkillExp").Find("Value").GetComponent <Text>(); view.CardPowerShow = root.Find("CardPower").Find("Value").GetComponent <Text>(); view.moneyValue = root.Find("money bar").Find("Value").GetComponent <Text>(); view.Properties = root.Find("Properties"); view.meili = view.Properties.Find("VBox").GetChild(0).GetChild(0).GetComponent <Text>(); view.jiyi = view.Properties.Find("VBox").GetChild(1).GetChild(0).GetComponent <Text>(); view.tili = view.Properties.Find("VBox").GetChild(2).GetChild(0).GetComponent <Text>(); view.koucai = view.Properties.Find("VBox").GetChild(3).GetChild(0).GetComponent <Text>(); view.fanying = view.Properties.Find("VBox").GetChild(4).GetChild(0).GetComponent <Text>(); view.Mask1 = root.Find("Mask#1").GetComponent <Image>(); view.Mask2 = root.Find("Mask#2").GetComponent <Image>(); foreach (Transform child in view.Properties.Find("VBox")) { PropertyMainView vv = new PropertyMainView(); vv.BindView(child); view.PropertyViewList.Add(vv); } view.EventsContainer = root.Find("Events"); view.AppsContainer = view.PhoneBigPic.transform.Find("Apps"); foreach (AppInfo app in model.UnlockedApps) { GameObject go = pResLoader.Instantiate("UI/app", view.AppsContainer); AppView appView = new AppView(); appView.BindView(go.transform); appView.icon.sprite = pResLoader.LoadResource <Sprite>("Textures/" + app.AppId); appView.title.text = app.ShowName; view.appViews.Add(appView); } view.FansShow = root.Find("Fans").Find("Value").GetComponent <Text>(); view.NextItemPrice = root.Find("NextItem").Find("Value").GetComponent <Text>(); view.NowSkillShow = root.Find("NowSkill").Find("Value").GetComponent <Text>(); view.SkillListShow = root.Find("NowSkill").Find("List").GetComponent <Text>(); // view.showAll = root.Find("Test").Find("Text").GetComponent <Text>(); view.BuyThings = root.Find("Test").Find("BuyThing").GetComponent <Button>(); view.NextTest = root.Find("Test").Find("Next").GetComponent <Button>(); view.UpdateCards = root.Find("Test").Find("UpdateCard").GetComponent <Button>(); view.Next30Turn = root.Find("Test").Find("Next30").GetComponent <Button>(); view.NextTest.onClick.AddListener(delegate { TestNextTurn(); }); view.BuyThings.onClick.AddListener(delegate { AdjustSkillCardCtrl cc = mUIMgr.ShowPanel("AdjustSkillCardsPanel") as AdjustSkillCardCtrl; cc.SetContent("test_01"); //UseResource(); }); view.UpdateCards.onClick.AddListener(delegate { AddSkill(); }); view.Next30Turn.onClick.AddListener(delegate { while (turn < 30) { UseResource(); AddSkill(); TestNextTurn(); } testUpdateWords(); pSkillMgr.PrintSkills(); }); view.currentTurn = root.Find("CurrentTurn").GetChild(0).GetComponent <Text>(); //testUpdateWords(); UpdateWords(); updateInitalData(); GetUnlockedParts(); }
public override void RegisterEvent() { view.NextStage.onClick.AddListener(delegate() { mUIMgr.CloseCertainPanel(this); SetupPlayerInfo(); MainGMInitData data = new MainGMInitData(); data.isNextTurn = true; GameMain.GetInstance().GetModule <CoreManager>().ChangeScene("Main", data); //mUIMgr.ShowPanel("UIMain"); }); for (int i = 0; i < view.avalableList.Count; i++) { DragEventListener listener = view.avalableList[i].root.gameObject.GetComponent <DragEventListener>(); if (listener == null) { listener = view.avalableList[i].root.gameObject.AddComponent <DragEventListener>(); SpecilistView speView = view.avalableList [i]; //GameObject go = view.avalableList [i].root.gameObject; RegisterAsAvailable(speView); } } foreach (BasePropertyLineView vv in view.baseLines) { BasePropertyLineView nowV = vv; int idx = view.baseLines.IndexOf(nowV); { //Debug.Log(idx + ":" + nowV.root.name); ClickEventListerner listener = vv.AddButton.gameObject.GetComponent <ClickEventListerner>(); if (listener == null) { listener = vv.AddButton.gameObject.AddComponent <ClickEventListerner>(); listener.OnClickEvent += delegate(PointerEventData eventData) { if (model.LeftPoint <= 0) { return; } if (model.extra[idx] >= RELOCATE_LIMIT) { view.WarningMsg.gameObject.SetActive(true); return; } else { view.WarningMsg.gameObject.SetActive(false); } Debug.Log("+++++"); model.LeftPoint--; model.extra[idx]++; view.PointLeft.text = model.LeftPoint + ""; view.baseLines[idx].BaseValue.text = model.bas[idx] + model.extra[idx] + ""; }; } } { ClickEventListerner listener = vv.MinusButton.gameObject.GetComponent <ClickEventListerner>(); if (listener == null) { listener = vv.MinusButton.gameObject.AddComponent <ClickEventListerner>(); listener.OnClickEvent += delegate(PointerEventData eventData) { if (model.extra[idx] > RELOCATE_LIMIT) { return; } if (model.extra[idx] <= 0) { return; } { view.WarningMsg.gameObject.SetActive(false); } Debug.Log("-----"); model.LeftPoint++; model.extra[idx]--; view.PointLeft.text = model.LeftPoint + ""; view.baseLines[idx].BaseValue.text = model.bas[idx] + model.extra[idx] + ""; }; } } } view.Next_Button.onClick.AddListener(delegate() { if (cur_section == 3) { mUIMgr.CloseCertainPanel(this); SetupPlayerInfo(); MainGMInitData data = new MainGMInitData(); data.isNextTurn = true; GameMain.GetInstance().GetModule <CoreManager>().ChangeScene("Main", data); } else { ShowNextSection(); if (cur_section == 2) { view.Back_Button.gameObject.SetActive(true); } if (cur_section == 3) { view.WarningMsg.gameObject.SetActive(false); view.Next_Button.GetComponent <Image>().sprite = pResMgr.LoadResource <Sprite>("Adjust/AdjustButton/go_stage"); } } }); view.Back_Button.onClick.AddListener(delegate() { ShowLastSection(); if (cur_section == 1) { view.Back_Button.gameObject.SetActive(false); } view.Next_Button.GetComponent <Image>().sprite = pResMgr.LoadResource <Sprite>("Adjust/AdjustButton/go_next"); }); }
public override void Tick(float dTime) { if (frameIdx < 0 || frameIdx >= model.frames.Count) { return; } if (model.frames [frameIdx].DialogType == eDialogFrameType.CHANGE_TEXT) { if (!isReading) { return; } DialogFrameText realFrame = model.frames [frameIdx] as DialogFrameText; if (cursorI >= realFrame.TextLines.Count) { isReading = false; return; } cursorF += Time.deltaTime * wordSpeed; int newCursorIdx = (int)cursorF; if (newCursorIdx == cursorI) { return; } if (newCursorIdx > realFrame.TextLines.Count) { newCursorIdx = realFrame.TextLines.Count; } for (int i = cursorI; i < newCursorIdx; i++) { textAppend(realFrame.TextLines[i]); } cursorI = newCursorIdx; } else if (model.frames [frameIdx].DialogType == eDialogFrameType.CHANGE_LIHUI) { if (!isMovingLihui) { DialogFrameLihui realFrame = model.frames [frameIdx] as DialogFrameLihui; for (int i = 0; i < view.LihuiList.Count; i++) { view.LihuiList [i].NeedMove = true; } numLihuiNeedMove = 0; for (int i = 0; i < realFrame.Opts.Count; i++) { if (realFrame.Opts [i] == "Enter") { if (realFrame.SlotIdxs [i] > model.LihuiIds.Count) { realFrame.SlotIdxs [i] = model.LihuiIds.Count; } model.LihuiIds.Insert(realFrame.SlotIdxs [i], realFrame.Lids [i]); GameObject l = GameMain.GetInstance().GetModule <ResLoader> ().Instantiate("Dialog/LihuiView", view.LihuiContainer); if (l == null) { Debug.Log("error"); continue; } LihuiView vv = new LihuiView(); vv.BindView(l.transform); vv.NeedMove = false; vv.Target = Vector2.zero; vv.pic.sprite = mResLoader.LoadResource <Sprite>("Dialog/Lihui/" + realFrame.Lids[i]); view.LihuiList.Insert(realFrame.SlotIdxs [i], vv); } else if (realFrame.Opts [i] == "Leave") { model.LihuiIds.RemoveAt(realFrame.SlotIdxs [i]); LihuiView vv = view.LihuiList [realFrame.SlotIdxs [i]]; view.LihuiList.RemoveAt(realFrame.SlotIdxs [i]); Vector2 target = vv.root.anchoredPosition + Vector2.up * 1000f; Tween tween = DOTween.To ( () => vv.root.anchoredPosition, (x) => vv.root.anchoredPosition = x, target, 0.5f ).OnComplete(delegate() { GameObject.Destroy(vv.root.gameObject); }); } } for (int i = 0; i < view.LihuiList.Count; i++) { Vector2 target = GetPosition(i); view.LihuiList[i].root.SetSiblingIndex(i); if (!view.LihuiList [i].NeedMove) { view.LihuiList [i].root.anchoredPosition = target; } else { LihuiView vv = view.LihuiList [i]; if ((vv.root.anchoredPosition - target).magnitude < 1f) { continue; } numLihuiNeedMove += 1; Tween tween = DOTween.To ( () => vv.root.anchoredPosition, (x) => vv.root.anchoredPosition = x, target, 0.5f ).OnComplete(delegate() { numLihuiNeedMove -= 1; }); } } isMovingLihui = true; } else { if (numLihuiNeedMove <= 0) { isMovingLihui = false; nextAction(); } } } else if (model.frames [frameIdx].DialogType == eDialogFrameType.CHANGE_BG) { nextAction(); } else if (model.frames [frameIdx].DialogType == eDialogFrameType.EFFECT) { if (!isEffecting) { isEffecting = true; } if (isEffecting) { view.bg.color = new Color(view.bg.color.r, view.bg.color.g, view.bg.color.b, view.bg.color.a - 1f * dTime); if (view.bg.color.a <= 0) { view.bg.color = new Color(view.bg.color.r, view.bg.color.g, view.bg.color.b, 1); nextAction(); isEffecting = false; } } } else if (model.frames [frameIdx].DialogType == eDialogFrameType.END) { Debug.Log("has finished"); finishDialog(); } else if (model.frames [frameIdx].DialogType == eDialogFrameType.SHOW_BRANCH) { if (isBranchFlashing) { } } }
public void ConvertToHeizi() { DOTween.To ( () => view.Content.transform.localEulerAngles, (x) => { view.Content.transform.localEulerAngles = x; }, new Vector3(0, 90, 0f), 0.075f ).OnComplete(delegate { view.Content.sprite = pResLoader.LoadResource <Sprite>("Zhibo/AudienceBG/heizi_bg"); UpdateHp(); DOTween.To ( () => view.Content.transform.localEulerAngles, (x) => { view.Content.transform.localEulerAngles = x; }, new Vector3(0, 0, 0f), 0.075f ).OnComplete(delegate { }); }); }