public void OnShow() { //data ServantData data = ServantManager.getInstace().getData(); UIList list = transform.Find("Group_ServantSelect/ScrollView/Viewport/Content").GetComponent <UIList>(); list.DrawList(data.nameToServant.Count, (index, listItem) => { Servant servant = data.nameToServant[index]; listItem.transform.Find("UIButton").GetComponent <Button>().onClick.AddListener(() => { GameObject uiDialogShop = UIManager.getInstace().ShowDialog("DlgShop"); uiDialogShop.GetComponent <DlgShop>().OnShow(servant.servantEName); }); listItem.transform.Find("UIText").GetComponent <Text>().text = servant.servantEName; }); }
static Global() { GameObject go = GameObject.Find("DontDestroyOnLoad"); DontDestroyOnLoad(go); Instace = go.AddComponent <Global>(); //Init Managers //uimanager always is the last one managers = new List <IManager>(); managers.Add(AudioManager.getInstace()); managers.Add(ResourceManager.getInstace()); managers.Add(ConfigManager.getInstace()); managers.Add(ServantManager.getInstace()); managers.Add(UIManager.getInstace()); foreach (var manager in managers) { manager.Init(); } }
// // Only for use by ObjectAdapterFactory // public ObjectAdapterI(Instance instance, Communicator communicator, ObjectAdapterFactory objectAdapterFactory, string name, RouterPrx router, bool noConfig) { instance_ = instance; _communicator = communicator; _objectAdapterFactory = objectAdapterFactory; _servantManager = new ServantManager(instance, name); _name = name; _incomingConnectionFactories = new List <IncomingConnectionFactory>(); _publishedEndpoints = new List <EndpointI>(); _routerEndpoints = new List <EndpointI>(); _routerInfo = null; _directCount = 0; _noConfig = noConfig; if (_noConfig) { _id = ""; _replicaGroupId = ""; _reference = instance_.referenceFactory().create("dummy -t", ""); _acm = instance_.serverACM(); return; } Properties properties = instance_.initializationData().properties; List <string> unknownProps = new List <string>(); bool noProps = filterProperties(unknownProps); // // Warn about unknown object adapter properties. // if (unknownProps.Count != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { StringBuilder message = new StringBuilder("found unknown properties for object adapter `"); message.Append(_name); message.Append("':"); foreach (string s in unknownProps) { message.Append("\n "); message.Append(s); } instance_.initializationData().logger.warning(message.ToString()); } // // Make sure named adapter has configuration. // if (router == null && noProps) { // // These need to be set to prevent warnings/asserts in the destructor. // state_ = StateDestroyed; instance_ = null; _incomingConnectionFactories = null; InitializationException ex = new InitializationException(); ex.reason = "object adapter `" + _name + "' requires configuration"; throw ex; } _id = properties.getProperty(_name + ".AdapterId"); _replicaGroupId = properties.getProperty(_name + ".ReplicaGroupId"); // // Setup a reference to be used to get the default proxy options // when creating new proxies. By default, create twoway proxies. // string proxyOptions = properties.getPropertyWithDefault(_name + ".ProxyOptions", "-t"); try { _reference = instance_.referenceFactory().create("dummy " + proxyOptions, ""); } catch (ProxyParseException) { InitializationException ex = new InitializationException(); ex.reason = "invalid proxy options `" + proxyOptions + "' for object adapter `" + _name + "'"; throw ex; } _acm = new ACMConfig(properties, communicator.getLogger(), _name + ".ACM", instance_.serverACM()); { int defaultMessageSizeMax = instance.messageSizeMax() / 1024; int num = properties.getPropertyAsIntWithDefault(_name + ".MessageSizeMax", defaultMessageSizeMax); if (num < 1 || num > 0x7fffffff / 1024) { _messageSizeMax = 0x7fffffff; } else { _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes } } try { int threadPoolSize = properties.getPropertyAsInt(_name + ".ThreadPool.Size"); int threadPoolSizeMax = properties.getPropertyAsInt(_name + ".ThreadPool.SizeMax"); if (threadPoolSize > 0 || threadPoolSizeMax > 0) { _threadPool = new ThreadPool(instance_, _name + ".ThreadPool", 0); } if (router == null) { router = RouterPrxHelper.uncheckedCast( instance_.proxyFactory().propertyToProxy(_name + ".Router")); } if (router != null) { _routerInfo = instance_.routerManager().get(router); if (_routerInfo != null) { // // Make sure this router is not already registered with another adapter. // if (_routerInfo.getAdapter() != null) { Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); ex.kindOfObject = "object adapter with router"; ex.id = Ice.Util.identityToString(router.ice_getIdentity()); throw ex; } // // Add the router's server proxy endpoints to this object // adapter. // EndpointI[] endpoints = _routerInfo.getServerEndpoints(); for (int i = 0; i < endpoints.Length; ++i) { _routerEndpoints.Add(endpoints[i]); } _routerEndpoints.Sort(); // Must be sorted. // // Remove duplicate endpoints, so we have a list of unique endpoints. // for (int i = 0; i < _routerEndpoints.Count - 1;) { EndpointI e1 = _routerEndpoints[i]; EndpointI e2 = _routerEndpoints[i + 1]; if (e1.Equals(e2)) { _routerEndpoints.RemoveAt(i); } else { ++i; } } // // Associate this object adapter with the router. This way, // new outgoing connections to the router's client proxy will // use this object adapter for callbacks. // _routerInfo.setAdapter(this); // // Also modify all existing outgoing connections to the // router's client proxy to use this object adapter for // callbacks. // instance_.outgoingConnectionFactory().setRouterInfo(_routerInfo); } } else { // // Parse the endpoints, but don't store them in the adapter. The connection // factory might change it, for example, to fill in the real port number. // List <EndpointI> endpoints = parseEndpoints(properties.getProperty(_name + ".Endpoints"), true); foreach (EndpointI endp in endpoints) { IncomingConnectionFactory factory = new IncomingConnectionFactory(instance, endp, this); _incomingConnectionFactories.Add(factory); } if (endpoints.Count == 0) { TraceLevels tl = instance_.traceLevels(); if (tl.network >= 2) { instance_.initializationData().logger.trace(tl.networkCat, "created adapter `" + _name + "' without endpoints"); } } // // Parse published endpoints. // _publishedEndpoints = parsePublishedEndpoints(); } if (properties.getProperty(_name + ".Locator").Length > 0) { setLocator(LocatorPrxHelper.uncheckedCast( instance_.proxyFactory().propertyToProxy(_name + ".Locator"))); } else { setLocator(instance_.referenceFactory().getDefaultLocator()); } } catch (LocalException) { destroy(); throw; } }
public void OnShow(string servantEName) { //animation needUpdate = false; //data servant = ServantManager.getInstace().getData().getServant(servantEName); data = servant.voiceData; List <ServantVoice> voices = data.getServantVoice(); servantStage = 1; currMode = 1; currTheme = 0; //ui reinit RectTran_ServantImage.anchorMin = initAnchor; RectTran_ServantImage.anchorMax = initAnchor; Image_ServantImage.sprite = servant.getDefaultExpression(servantStage); Transform_ServantExpression.localPosition = servant.expressionLocation1; SetExpression(Image_ServantExpression, null); //刑部姬戴帽子 造型 stage1 x-2.1 y103 // stage2 x-3.55 y102.1 // -2.09 109.9 servantWord_Narrow.gameObject.SetActive(false); servantWord_Wide.gameObject.SetActive(false); //右边的界面的显隐也要控制 //bg and bgm Group_Bg.GetComponent <Image>().sprite = ResourceManager.getInstace().getBGSprite(servant.BGSprite); BGMPlayer = Group_Bg.GetComponent <AudioSource>(); BGMPlayer.clip = ResourceManager.getInstace().getBGM(servant.BGM); BGMPlayer.Play(); //playVoice action PlayVoice = voice => { //模仿对话界面 如果当前正在播放语音 那么关闭语音。如果没有播放语音则播放 //想这两种对话框 其实应该提取出来 作为一个view的 不应该绑定在具体哪一个界面上 if (isPlayingVoice()) { ForceCloseVoice(); return; } VoicePlayer = AudioManager.getInstace().Play2DSound(servantEName, voice.getVoiceId(), () => { if (currMode != 2) { servantWord_Narrow.gameObject.SetActive(true); Text_Speaker_Narrow.text = voice.getServantName(); Text_Content_Narrow.text = voice.getVoiceContent(); } else { servantWord_Wide.gameObject.SetActive(true); Text_Speaker_Wide.text = voice.getServantName(); Text_Content_Wide.text = voice.getVoiceContent(); } }, () => { SetExpression(Image_ServantExpression, null); if (currMode != 2) { servantWord_Narrow.gameObject.SetActive(false); } else { servantWord_Wide.gameObject.SetActive(false); } } ); Dictionary <float, string> timeToExpression = voice.getTimeToExpression(); foreach (KeyValuePair <float, string> entry in timeToExpression) { if (entry.Key >= VoicePlayer.length - 0.1f || entry.Key <= 0) { continue; } IEnumerator expressionCoroutine = ShowExpression(entry.Key, entry.Value); StartCoroutine(expressionCoroutine); } // IEnumerator expressionEndCoroutine = ShowExpression(VoicePlayer.length, null); // StartCoroutine(expressionEndCoroutine); }; Button_ServantImage.onClick.RemoveAllListeners(); Button_ServantImage.onClick.AddListener(() => { int index = UnityEngine.Random.Range(0, voices.Count); ServantVoice voice = voices[index]; // ServantVoice voice; // while (true) // { // voice = voices[index]; // if (voice.getVoiceType() == 2 || voice.getVoiceType() == 3) // { // break; // } // } PlayVoice.Invoke(voice); }); //右边 Transform Tran_DropdownVoiceType = Group_ServantVoice.Find("Dropdown_VoiceType"); Transform Tran_Content = Group_ServantVoice.Find("ScrollView/Viewport/Content"); Dropdown dropDown = Tran_DropdownVoiceType.GetComponent <Dropdown>(); dropDown.ClearOptions(); List <Dropdown.OptionData> temp = new List <Dropdown.OptionData>(); // foreach (int type in Enum.GetValues(typeof(CommonEnum.VoiceType))) // { // // } temp.Add(new Dropdown.OptionData("战斗")); temp.Add(new Dropdown.OptionData("召唤与强化")); temp.Add(new Dropdown.OptionData("个人空间")); temp.Add(new Dropdown.OptionData("活动")); dropDown.options = temp; dropDown.onValueChanged.AddListener(index => { List <ServantVoice> typeVoices = data.getVoicesByType(index); Tran_Content.GetComponent <UIList>().DrawList(typeVoices.Count, (btnindex, obj) => { ServantVoice voice = typeVoices[btnindex]; obj.GetComponent <UIItem>().DrawItem(voice.getVoiceTitle(), () => { PlayVoice.Invoke(voice); }); }); }); dropDown.value = 4; dropDown.value = 3; }
// Use this for initialization void Start() { MapGen = GameObject.FindGameObjectWithTag ("Generator").GetComponent<PanelGen>(); SVManager = GameObject.FindGameObjectWithTag ("ServantManager").GetComponent<ServantManager> (); totalMoveTime = 0f; }
void Start() { SVManager = GameObject.FindGameObjectWithTag ("ServantManager").GetComponent<ServantManager> (); }