private void processRecord(MemoryStream record) { var wav = SoundTools.ConvertSamplesToWavFileFormat(record, sampleRate); var flac = new MemoryStream(); SoundTools.Wav2Flac(wav, flac); try { var result = GoogleVoice.GoogleSpeechRequest(flac, sampleRate, Language, MaxResults); if (result.Length > 0) { if (OnSpeechRecognized != null) { OnSpeechRecognized(result); } } else if (OnSpeechRecognizeFailed != null) { OnSpeechRecognizeFailed(); } } catch (Exception ex) { if (OnGoogleError != null) { OnGoogleError(ex); } } }
public virtual void Show() { // 加入到从属的AppState的UIManager中. UIManager.Instance.ShowUI(this); //2015-7-15 xiaoxiao add SoundTools.PlaySound(SOUND_ID.SOUND_CLOSEUI); }
public void OnClick() { if (Input.touchCount > 1) { return; } if (mOnTouchButtonHandler != null) { mOnTouchButtonHandler(this, null, m_HandlerParam1, m_HandlerParam2); } if (mOnClick != null) { if (GamePlayer.Instance.isInBattle && gameObject.CompareTag("DisableInBattle")) { //PopText.Instance.Show(LanguageManager.instance.GetValue("battlecannot"), PopText.WarningType.WT_Warning, true); return; } mOnClick.HandlerCallback(this, null); //2015-7-15 xiaoxiao add SoundTools.PlaySound(SOUND_ID.SOUND_BUTTONCLICK); } //////////////////////////////////////////////////////////// }
public void ClearCurrentState() { CinemaManager cm = GameObject.FindObjectOfType <CinemaManager>(); if (cm != null) { cm.Clear(); } _IsSenseMode = false; nextBattle_ = null; XInput.Instance.dealInput = true; CreatePlayerRole.Reset(); GlobalInstanceFunction.Instance.Clear(); Battle.Instance.ResetData(); TeamSystem._MyTeamInfo = null; Prebattle.Instance.Fini(); Prebattle.Instance.StopAllAutoSystem(); Prebattle.Instance.nextInfo_ = null; Prebattle.Instance.tooFastOper = false; StageMgr.ClearStageLoadQue(); EffectMgr.Instance.DeleteAll(); GamePlayer.Instance.isInBattle = false; GuildSystem.Clear(); TeamSystem.Clear(); SuccessSystem.Clear(); GatherSystem.instance.Clear(); GuideManager.Instance.ClearMask(); UIFactory.Instance.ClearLoadedUI(); SoundTools.StopMusic(); RaiseUpSystem.Clear(); BagSystem.instance.BagClear(); PopText.Instance.Clear(); GamePlayer.Instance.babies_list_.Clear(); }
public static void FinishPlayRecord() { audios.Stop(); SoundTools.ResumeMusic(); SoundTools.ResumeSound(); if (finishAudioOk != null) { finishAudioOk(); } }
public static void StartRecord() { SoundTools.PauseMusic(); SoundTools.PauseSound(); AClip = Microphone.Start(null, false, RecordTime, Frequency); //14400 while (!(Microphone.GetPosition(null) > 0)) { ; } time = Time.realtimeSinceStartup; ClientLog.Instance.Log("StartRecord"); }
public static void StopRecord() { SoundTools.ResumeMusic(); SoundTools.ResumeSound(); if (!Microphone.IsRecording(null)) { return; } Microphone.End(null); time = Time.realtimeSinceStartup - time; time = time > RecordTime ? RecordTime : time; ClientLog.Instance.Log("Stop record clip time is " + time); }
//void OnClick() //{ // if (trigger == Trigger.OnClick) // Play(); //} //void OnSelect(bool isSelected) //{ // if (canPlay && (!isSelected || UICamera.currentScheme == UICamera.ControlScheme.Controller)) // OnHover(isSelected); //} //public void Play() //{ // if (!IsCanPlay) return; // if (soundType == UISoundType.Click) // { // //GameSoundPlayer.Instance.PlaySoundEffect("点击按钮");//.SoundEffectPlayer.Play("点击按钮"); // ////ZLog.Info("点击 按钮 声音"); // GameSoundPlayer.Instance.PlaySoundEffect("Button"); // } //} public void OnPointerClick(PointerEventData eventData) { //Play(); if (!btnNo) { SoundTools.PlaySoundEffect("Button", Vector3.zero); } //GameSoundPlayer.Instance?.PlaySoundEffect("Button"); //if (btn != null) //{ // if (btn.interactable) // { // Play(); // } //} }
private void RegisterMessages() { Messenger.Default.Register <NotificationMessageAction <object> >(this, (message) => { switch (message.Notification) { case Constants.InitializeStreaming: message.Execute(previewLayer); break; } }); Messenger.Default.Register <NotificationMessage>(this, (message) => { switch (message.Notification) { case Constants.TakingPhoto: PreviewImage.Image = null; SoundTools.TriggerSoundAndViber(); break; } }); Messenger.Default.Register <NotificationMessage <byte[]> >(this, (message) => { switch (message.Notification) { case Constants.PhotoTaken: PreviewImage.Image = null; PreviewImage.Image = UIImage.LoadFromData(NSData.FromArray(message.Content));; break; } }); Messenger.Default.Register <PropertyChangedMessageBase>(this, true, (property) => { if (property.PropertyName == "StatusMessage") { var topCorrect = MessageText.Bounds.Height - MessageText.ContentSize.Height; topCorrect = (topCorrect < 0.0f ? 0.0f : topCorrect); MessageText.ContentOffset = new CGPoint(0, -topCorrect); } }); }
public static void AudioOk(int id, byte[] content) { if (!AudioDic.ContainsKey(id)) { AudioDic.Add(id, content); } SoundTools.PauseMusic(); SoundTools.PauseSound(); ChatSystem.PlayRecord(content, audios, delegate { GlobalInstanceFunction.Instance.Invoke(FinishPlayRecord, audios.clip.length); }); if (startAudioOk != null) { startAudioOk(id); } }
private void RegisterMessages() { Messenger.Default.Register <NotificationMessageAction <object> >(this, (message) => { switch (message.Notification) { case Constants.InitializeStreaming: message.Execute(previewLayer); break; } }); Messenger.Default.Register <NotificationMessage>(this, (message) => { switch (message.Notification) { case Constants.TakingPhoto: PreviewImage.Image = null; SoundTools.TriggerSoundAndViber(); break; } }); Messenger.Default.Register <NotificationMessage <byte[]> >(this, (message) => { switch (message.Notification) { case Constants.PhotoTaken: PreviewImage.Image = null; PreviewImage.Image = UIImage.LoadFromData(NSData.FromArray(message.Content));; break; } }); Messenger.Default.Register <PropertyChangedMessageBase>(this, true, (property) => { if (property.PropertyName == "StatusMessage") { MoveStatusMessageInTheRightPosition(); } }); }
public static void ExcuteLoadedEvent() { Transform trans = null; if (ApplicationEntry.Instance != null) { for (int i = 0; i < ApplicationEntry.Instance.uiRoot.transform.childCount; ++i) { trans = ApplicationEntry.Instance.uiRoot.transform.GetChild(i); if (trans.gameObject.name.Equals("NameLabel")) { GameObject.Destroy(trans.gameObject); } } } Loading = false; if (OnSceneLoaded != null) { OnSceneLoaded(Scene_name); } SceneData sd = SceneData.GetData(GameManager.SceneID); if (sd == null) { return; } MusicAssetsData mdata = MusicAssetsData.GetData(sd.M_ID); if (!GlobalValue.isBattleScene(Scene_name)) { SoundTools.PlayMusic((MUSIC_ID)mdata.id_); } if (!BagSystem.instance.IsInit && !Scene_name.Equals("LoginScene") && !Scene_name.Equals("CreateRoleScene")) { NetConnection.Instance.requestBag(); } }
/// <summary> 從指定檔案中載入聲音資料 </summary> /// <param name="path"></param> public void SetSoundFromFile(string path) { if (!File.Exists(path)) { throw new FileNotFoundException(string.Format("找不到 {0} ", path)); } BinaryReader reader = new BinaryReader(File.OpenRead(path)); string tag = Encoding.ASCII.GetString(reader.ReadBytes(4)); if (tag == "RIFF") { SoundTools.LoadWAV(this, reader); return; } else if (tag.Substring(0, 3) == "ID3") { SoundTools.LoadMP3_ID3(this, reader); return; } else if (reader.BaseStream.Length >= 128) { reader.BaseStream.Seek(-128, SeekOrigin.End); if (Encoding.ASCII.GetString(reader.ReadBytes(3)) == "TAG") { SoundTools.LoadMP3_TAG(this, reader); return; } } try { reader.BaseStream.Seek(0, SeekOrigin.Begin); SoundTools.LoadMP3_ReadFrameData(this, reader, (int)(reader.BaseStream.Length)); return; } catch (Exception) { throw new NotSupportedException("檔案必須要是 wave 或 mp3 格式"); } }
private void RegisterMessages() { Messenger.Default.Register <NotificationMessageAction <object> >(this, (message) => { switch (message.Notification) { case Constants.InitializeStreaming: message.Execute(previewLayer); break; } }); Messenger.Default.Register <NotificationMessage>(this, (message) => { switch (message.Notification) { case Constants.TakingPhoto: SoundTools.TriggerSoundAndViber(); break; } }); }
public static void Play(EFFECT_ID id, Vector3 caster, Vector3[] aims = null, TakeDmgCallBackPack takedmagepack = null, EffectInst.FinishCallBack finishcallback = null, EffectInstanceCallBack effectinstancecallback = null, ParamData data = null, Transform[] parents = null) { EffectAssetsData ead = EffectAssetsData.GetData((int)id); if (ead == null) { ClientLog.Instance.LogError("could not find the effect asset by id: " + id + " caster position is " + caster); return; } int SoundId = EffectAssetsData.GetData((int)id).SoundID; SoundTools.PlaySound((SOUND_ID)SoundId); ////////////////////////////////////////////////////////////////////////// // aims 有可能是null // 但在进场景那一刻 有可能会出现 需要有目标的特效没有目标 可能会导致卡死 // 考虑是否加一个完成回调 EffectBehaviourData ebd = EffectBehaviourData.GetData(ead.behaviour_id_); if (ebd != null) { EffectBehaviourData.CASTTYPE castType = ebd.cast_type_; int maxCount = (aims == null? 0: aims.Length); // int maxCount = aims.Length; if (castType.Equals(EffectBehaviourData.CASTTYPE.SameTime) || castType.Equals(EffectBehaviourData.CASTTYPE.OneByOne)) { if (aims != null) { for (int i = 0; i < maxCount; ++i) { EffectMgr.Instance.LoadEffect( id, EffectInstCallBack, new MetaData(takedmagepack == null? null: takedmagepack.hit_1, takedmagepack == null? null: takedmagepack.hit_2, takedmagepack == null? null: takedmagepack.effect, takedmagepack == null? null: takedmagepack.changeVal, i == aims.Length - 1? finishcallback: null, caster, new Vector3[] { aims[i] }, data == null? i: data.iParam, effectinstancecallback, data == null? new ParamData(i): data, parents)); } } else { EffectMgr.Instance.LoadEffect(id, EffectInstCallBack, new MetaData(takedmagepack == null? null: takedmagepack.hit_1, takedmagepack == null? null: takedmagepack.hit_2, takedmagepack == null? null: takedmagepack.effect, takedmagepack == null ? null : takedmagepack.changeVal, finishcallback, caster, aims, 0, effectinstancecallback, data, parents)); } } else if (castType.Equals(EffectBehaviourData.CASTTYPE.OnlyOne)) { EffectMgr.Instance.LoadEffect(id, EffectInstCallBack, new MetaData(takedmagepack == null? null: takedmagepack.hit_1, takedmagepack == null? null: takedmagepack.hit_2, takedmagepack == null? null: takedmagepack.effect, takedmagepack == null ? null : takedmagepack.changeVal, finishcallback, caster, aims, 0, effectinstancecallback, data, parents)); } } else { EffectMgr.Instance.LoadEffect(id, EffectInstCallBack, new MetaData(takedmagepack == null? null: takedmagepack.hit_1, takedmagepack == null? null: takedmagepack.hit_2, takedmagepack == null? null: takedmagepack.effect, takedmagepack == null ? null : takedmagepack.changeVal, finishcallback, caster, aims, 0, effectinstancecallback, data, parents)); } }
void OnClickSoundOff(ButtonScript obj, object args, int param1, int param2) { SetSoundState(false); SoundTools.StopSound(); }
void OnClickmusicOn(ButtonScript obj, object args, int param1, int param2) { SetMusicState(true); SoundTools.OpenMusic(); }
void Start() { int mucId = 0; if (Battle.Instance.battleType == BattleType.BT_PVE) { if (Battle.Instance.BattleID == 0) { GlobalValue.Get(Constant.C_BossMuc, out mucId); SoundTools.PlayMusic((MUSIC_ID)mucId); } else { GlobalValue.Get(Constant.C_PutnMuc, out mucId); SoundTools.PlayMusic((MUSIC_ID)mucId); } } else if (Battle.Instance.battleType == BattleType.BT_PVP) { GlobalValue.Get(Constant.C_PvpMuc, out mucId); SoundTools.PlayMusic((MUSIC_ID)mucId); } HideAttackType(); levelLabel.text = GamePlayer.Instance.Properties [(int)PropertyType.PT_Level].ToString(); HeadIconLoader.Instance.LoadIcon("R_" + EntityAssetsData.GetData((int)GamePlayer.Instance.Properties [(int)PropertyType.PT_AssetId]).assetsIocn_, palyIcon); HUD.SetActive(false); attackNumSp.transform.gameObject.SetActive(false); closeSkillWindow(); closeSkillTwoWindow(); ClosePetWindow(); lstEntityUI = new List <GameObject>(); GameObject pos = GameObject.Find("CenterPoint"); if (pos == null) { return; } CountDownG.transform.localPosition = GlobalInstanceFunction.WorldToUI(pos.transform.position); tempstr = playernanmeLabel.text; BagSystem.instance.UpdateItemEvent += OnItemUpdate; BagSystem.instance.DelItemInstEvent += OnItemDelete; BagSystem.instance.ItemChanged += OnItemAdd; BagSystem.instance.BattleOpenBagEvent += new RequestEventHandler <bool>(OpenBagEvent); UIManager.Instance.showMainPanelEnvent += new RequestEventHandler <bool>(AttackPanelShow); UpdateItemCount(); buttons.Add(attackBtn); buttons.Add(skillBtn); buttons.Add(DefenseBtn); buttons.Add(PosBtn); buttons.Add(AUTOBtn); buttons.Add(ArticleBtn); buttons.Add(petBtn); buttons.Add(fleeBtn); buttons.Add(catchBtn); UIManager.SetButtonEventHandler(teamBtn.gameObject, EnumButtonEvent.OnClick, teamBtnClick, 0, 0); UIManager.SetButtonEventHandler(zihyinBtn.gameObject, EnumButtonEvent.OnClick, zihyinBtnClick, 0, 0); UIManager.SetButtonEventHandler(renwuBtn.gameObject, EnumButtonEvent.OnClick, OnClickrenwuBtn, 0, 0); UIManager.SetButtonEventHandler(skilliBtn.gameObject, EnumButtonEvent.OnClick, OnClickskilliBtn, 0, 0); //UIManager.SetButtonEventHandler (bagaBtn.gameObject, EnumButtonEvent.OnClick, OnClickbagaBtn, 0, 0); UIManager.SetButtonEventHandler(shopBtn.gameObject, EnumButtonEvent.OnClick, OnClickshopBtn, 0, 0); UIManager.SetButtonEventHandler(famBtn.gameObject, EnumButtonEvent.OnClick, OnClickfamBtn, 0, 0); UIManager.SetButtonEventHandler(huodongBtn.gameObject, EnumButtonEvent.OnClick, OnClickhuodongBtn, 0, 0); UIManager.SetButtonEventHandler(jincaBtn.gameObject, EnumButtonEvent.OnClick, OnClickjincaBtn, 0, 0); UIManager.SetButtonEventHandler(backBtn.gameObject, EnumButtonEvent.OnClick, BackClick, 0, 0); UIManager.SetButtonEventHandler(PlayerBackBtn.gameObject, EnumButtonEvent.OnClick, PlayerBackClick, 0, 0); UIManager.SetButtonEventHandler(catchBtn.gameObject, EnumButtonEvent.OnClick, OnClickCatchBtn, 0, 0); UIManager.SetButtonEventHandler(attackBtn.gameObject, EnumButtonEvent.OnClick, OnClickattackBtn, 0, 0); UIManager.SetButtonEventHandler(skillBtn.gameObject, EnumButtonEvent.OnClick, OnClickskillBtn, 0, 0); UIManager.SetButtonEventHandler(DefenseBtn.gameObject, EnumButtonEvent.OnClick, OnClickDefenseBtn, 0, 0); UIManager.SetButtonEventHandler(PosBtn.gameObject, EnumButtonEvent.OnClick, OnClickPosBtn, 0, 0); UIManager.SetButtonEventHandler(AUTOBtn.gameObject, EnumButtonEvent.OnClick, OnClickAUTOBtn, 0, 0); UIManager.SetButtonEventHandler(ArticleBtn.gameObject, EnumButtonEvent.OnClick, OnClickArticleBtn, 0, 0); UIManager.SetButtonEventHandler(petBtn.gameObject, EnumButtonEvent.OnClick, OnClickpetBtn, 0, 0); UIManager.SetButtonEventHandler(fleeBtn.gameObject, EnumButtonEvent.OnClick, OnClickfleeBtn, 0, 0); UIManager.SetButtonEventHandler(CanAUTOBtn.gameObject, EnumButtonEvent.OnClick, OnClickCanAUTO, 0, 0); UIManager.SetButtonEventHandler(speedUpBtn_.gameObject, EnumButtonEvent.OnClick, OnSpeedUpBtn, 0, 0); UIManager.SetButtonEventHandler(playerActionBtn.gameObject, EnumButtonEvent.OnClick, OnPlayerActionBtn, 0, 0); UIManager.SetButtonEventHandler(petActionBtn.gameObject, EnumButtonEvent.OnClick, OnPetActionBtn, 0, 0); UIManager.SetButtonEventHandler(babyHUD.gameObject, EnumButtonEvent.OnClick, OnShowBaby, 0, 0); UIEventListener.Get(playeroBJ).onClick = OnOpenPlayer; AutoPlayerPanel.GetComponent <ChangeAutoOrder>().operatType_ = OperateType.OT_P1; AutoPetPanel.GetComponent <ChangeAutoOrder>().operatType_ = OperateType.OT_B; curHp = GamePlayer.Instance.GetIprop(PropertyType.PT_HpCurr); curMp = GamePlayer.Instance.GetIprop(PropertyType.PT_MpCurr); if (GamePlayer.Instance.BattleBaby != null) { curHpbb = GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_HpCurr); curMpbb = GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_MpCurr); } speedUpBtn_.normalSprite = Battle.Instance.speedUpOn_ ? speedUpImg : normalImg; if (GuildSystem.IsInGuild()) { famBtn.isEnabled = true; UISprite sp = famBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); } else { UISprite sp = famBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); famBtn.isEnabled = false; } if (TeamSystem.IsInTeam()) { UISprite sp = teamBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); teamBtn.isEnabled = true; } else { UISprite sp = teamBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); teamBtn.isEnabled = false; } if (GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Shop)) { UISprite sp = shopBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); shopBtn.isEnabled = true; } else { UISprite sp = shopBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); shopBtn.isEnabled = false; } if (GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Guid)) { UISprite sp = zihyinBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); zihyinBtn.isEnabled = true; } else { UISprite sp = zihyinBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); zihyinBtn.isEnabled = false; } if (GamePlayer.Instance.GetOpenSubSystemFlag(OpenSubSystemFlag.OSSF_Activity)) { UISprite sp = huodongBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(255, 255, 255); huodongBtn.isEnabled = true; } else { UISprite sp = huodongBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); huodongBtn.isEnabled = false; } if (GamePlayer.Instance.GetIprop(PropertyType.PT_Level) >= GamePlayer.Instance.openADActivityLv) { UISprite sp = jincaBtn.GetComponentInChildren <UISprite>(); if (GamePlayer.Instance.adTypes.Count == 0) { sp.color = new Color(0, 255, 0); jincaBtn.isEnabled = false; } if (GamePlayer.Instance.adTypes.Count > 0) { sp.color = new Color(255, 255, 255); jincaBtn.isEnabled = true; } } else { UISprite sp = jincaBtn.GetComponentInChildren <UISprite>(); sp.color = new Color(0, 255, 0); jincaBtn.isEnabled = false; } GuideManager.Instance.RegistGuideAim(attackBtn.gameObject, GuideAimType.GAT_BattleAttack); GuideManager.Instance.RegistGuideAim(skillBtn.gameObject, GuideAimType.GAT_BattleSkill); GuideManager.Instance.RegistGuideAim(AUTOBtn.gameObject, GuideAimType.GAT_BattleAuto); GuideManager.Instance.RegistGuideAim(ArticleBtn.gameObject, GuideAimType.GAT_BattleBag); GuideManager.Instance.RegistGuideAim(catchBtn.gameObject, GuideAimType.GAT_BattleCatch); GuideManager.Instance.RegistGuideAim(playerActionBtn.gameObject, GuideAimType.GAT_PlayerAuto); GlobalInstanceFunction.Instance.UpdatecounDownTime += attackEvent; if (GuideManager.Instance.InBattleGuide_) { CloseCountDown(); } AttaclEvent.getInstance.OnSetPanelActive += SetSelfActive; huiheObj.SetActive(false); hasDestroy = false; SetBabyInfo(); }
void OnClickmusicOff(ButtonScript obj, object args, int param1, int param2) { SetMusicState(false); SoundTools.SetStopMusic(); }
void OnClickSoundOn(ButtonScript obj, object args, int param1, int param2) { SetSoundState(true); SoundTools.OpenSound(); }
private void PlayFieldFootAudioEffect(int i) { if (DisableFootAudio) { return; } int index = FootPrintTrigger.indexs[i]; if (index != 3) { return; } //index += 1; count++; if (count % 2 == 0) { switch (effectType) { case 3: //grass //SoundTools.PlaySoundEffect("Grassland-1"/* + index.ToString()*/, FootPrintTrigger.footPositions[i]); SoundTools.PlaySoundEffect("Grassland-1", FootPrintTrigger.footPositions[i]); break; case 4: //muddy //SoundTools.PlaySoundEffect("Muddyland-1" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]); SoundTools.PlaySoundEffect("Muddyland-1", FootPrintTrigger.footPositions[i]); break; case 5: //land //SoundTools.PlaySoundEffect("Sand-1" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]); SoundTools.PlaySoundEffect("sand-1", FootPrintTrigger.footPositions[i]); break; } } else { switch (effectType) { case 3: //grass //SoundTools.PlaySoundEffect("Grassland-2"/* + index.ToString()*/, FootPrintTrigger.footPositions[i]); SoundTools.PlaySoundEffect("Grassland-2", FootPrintTrigger.footPositions[i]); break; case 4: //muddy //SoundTools.PlaySoundEffect("Muddyland-2" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]); SoundTools.PlaySoundEffect("Muddyland-2", FootPrintTrigger.footPositions[i]); break; case 5: //land //SoundTools.PlaySoundEffect("Sand-2" /*+ index.ToString()*/, FootPrintTrigger.footPositions[i]); SoundTools.PlaySoundEffect("sand-2", FootPrintTrigger.footPositions[i]); break; } } }
public void UpdateItem(COM_Item item) { if (BagItems[item.slot_] == null) { return; } COM_Item bagItem = GetItemByInstId((int)item.instId_); if (bagItem != null) { ItemData iData = ItemData.GetData((int)item.itemId_); string itemName = iData.name_; string itemColor = ""; if ((int)iData.quality_ >= (int)QualityColor.QC_Orange2) { itemColor = "fb851c"; } if ((int)iData.quality_ <= (int)QualityColor.QC_White) { itemName = ""; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Green) { itemColor = "5efd52"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Blue1) { itemColor = "4594ff"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Purple2) { itemColor = "ad52fa"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Golden2) { itemColor = "eef001"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Orange2) { itemColor = "fb851c"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Pink) { itemColor = "f66099"; } int num = bagItem.stack_; int curNum = num - item.stack_; if (curNum > 0) { if (!LotteryPanelUI.isOpen && !CompoundUI.isOpen) { PopText.Instance.Show(LanguageManager.instance.GetValue("xiaohaoitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString()), PopText.WarningType.WT_Tip, GamePlayer.Instance.isInBattle); } ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("xiaohaoitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString())); } else if (curNum < 0) { if (!LotteryPanelUI.isOpen && !CompoundUI.isOpen) { PopText.Instance.Show(LanguageManager.instance.GetValue("getitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString()), PopText.WarningType.WT_None, false, itemColor); //PopText.Instance.Show (LanguageManager.instance.GetValue("getitem").Replace("{n}", ItemData.GetData((int)item.itemId_).name_)); } ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("getitemwupin").Replace("{n}", ItemData.GetData((int)item.itemId_).name_).Replace("{n1}", Mathf.Abs(curNum).ToString())); } } BagItems [item.slot_] = item; if (UpdateItemEvent != null) { UpdateItemEvent.Invoke(item); } isDirty_ = true; ItemData idata = ItemData.GetData((int)item.itemId_); if (idata == null) { return; } if (idata.mainType_ == ItemMainType.IMT_Consumables) { isUse = true; //ChatSystem.instance.AddchatInfo( LanguageManager.instance.GetValue("delitem").Replace("{n}",idata.name_),ChatKind.CK_System,false); } EmployessSystem.instance.UpdateEmployeeRed(); QuestSystem.CheckItemQuest(item.itemId_); SoundTools.PlaySound(SOUND_ID.SOUND_HUODEWUQIN); }
public void AddItem(COM_Item item) { ItemData iData = ItemData.GetData((int)item.itemId_); if (iData == null) { return; } _BagItems[item.slot_] = item; if (iData.mainType_ == ItemMainType.IMT_BabyEquip) { _BabyEquips.Add(item); isBabyEquipDirty_ = true; } if (item.instId_ == recentlyTakeoffEquip) { addItemIsFromBody = true; } if (ItemChanged != null) { ItemChanged.Invoke(item); // if(ItemData.GetData((int)item.itemId_).mainType_ == ItemMainType.IMT_Equip) // { // FastUpload.Instance.OnItemAdd(item); // } GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_GainItem, (int)item.itemId_); } isDirty_ = true; addItemIsFromBody = false; recentlyTakeoffEquip = 0; //COM_Chat info = new COM_Chat (); // COM_ChatInfo info = new COM_ChatInfo (); // info.ck_ = ChatKind.CK_System; // info.content_ = LanguageManager.instance.GetValue("getitem").Replace("{n}",ItemData.GetData((int)item.itemId_).name_); //NetConnection.Instance.sendChat(info, ""); string itemName = iData.name_; string itemColor = ""; if ((int)iData.quality_ >= (int)QualityColor.QC_Orange2) { itemColor = "fb851c"; } if ((int)iData.quality_ <= (int)QualityColor.QC_White) { itemName = ""; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Green) { itemColor = "5efd52"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Blue1) { itemColor = "4594ff"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Purple2) { itemColor = "ad52fa"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Golden2) { itemColor = "eef001"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Orange2) { itemColor = "fb851c"; } else if ((int)iData.quality_ <= (int)QualityColor.QC_Pink) { itemColor = "f66099"; } if (!LotteryPanelUI.isOpen && !CompoundUI.isOpen) { PopText.Instance.Show(LanguageManager.instance.GetValue("getitem").Replace("{n}", ItemData.GetData((int)item.itemId_).name_), PopText.WarningType.WT_None, false, itemColor); } ChatSystem.PushSystemMessage(LanguageManager.instance.GetValue("getitem").Replace("{n}", ItemData.GetData((int)item.itemId_).name_)); EmployessSystem.instance.UpdateEmployeeRed(); QuestSystem.CheckItemQuest(item.itemId_); SoundTools.PlaySound(SOUND_ID.SOUND_HUODEWUQIN); }