public GameController(IDebug debug, IUiObject uiObject, IGeneticAlgorithm ga, IMainGameObject mainGameObject) { this.debug = debug; this.uiObject = uiObject; this.ga = ga; this.mainGameObject = mainGameObject; }
public void AddChild(IUiObject child) { var localPos = child.gameObject.transform.localPosition; child.gameObject.transform.parent = gameObject.transform; child.gameObject.transform.localPosition = localPos; }
public static void SetTexture(IUiObject uiObject, string url) { var image = uiObject.gameObject.GetComponent <RawImage>(); if (image == null) { return; } CoroutineRunner.StartCoroutine(uiObject.gameObject, ResourceUtility.LoadImage(image, url)); }
void Awake() { _components = new List <IFreeComponent>(); SingletonManager.Get <SimpleUIUpdater>().Add(this); _uiObject = new UnityUiObject(gameObject); _screenWidth = Screen.width; _screenHeight = Screen.height; }
/// <summary> /// This method add a new data field /// </summary> /// <param name="item"></param> public void AddDataField(IUiObject item) { _objectList.Add(item); if (item is UiDualDfSearchTextObject) { UiDualDfSearchTextObject currentDfSearchTextObject = (UiDualDfSearchTextObject)item; _assistTables.Add(currentDfSearchTextObject.AssistTableName); } _tableName = item.TableName; _tables.Add(_tableName); _primaryKey = item.PrimaryKey; _currentListString = CreateStringList(); }
public IDictionary <string, ObservableCollection <IUiObject> > BuildPageObjects(UiDualDfSearchTextObject.OnAssistQueryRequestHandler assistQuery, UiDfObject.ChangedField changedField) { ObservableCollection <IUiObject> observableCollection = new ObservableCollection <IUiObject>(); IDictionary <string, ObservableCollection <IUiObject> > collect = new Dictionary <string, ObservableCollection <IUiObject> >(); for (int i = 0; i < UpperPartFields.Length - 1; ++i) { UiDfObject dataUiDfObject = new UiDfObject(); dataUiDfObject.LabelText = ProviderConstants.UpperPartLabel[i]; dataUiDfObject.DataField = UpperPartFields[i]; dataUiDfObject.LabelTextWidth = UiConstants.LabelTextWidthDefault; dataUiDfObject.TextContentWidth = UiConstants.TextBoxWidthDefault; dataUiDfObject.Height = UiConstants.TextboxHeight; dataUiDfObject.TableName = "PROVEE1"; dataUiDfObject.PrimaryKey = ProviderConstants.PrimaryKey; dataUiDfObject.OnChangedField += changedField; dataUiDfObject.AllowedEmpty = true; dataUiDfObject.IsReadOnly = (dataUiDfObject.DataField == UpperPartFields[0]); dataUiDfObject.IsVisible = true; if (dataUiDfObject.DataField == UpperPartFields[0]) { dataUiDfObject.TextContentWidth = UiConstants.TextBoxWidthSmall; } if (dataUiDfObject.DataField == UpperPartFields[1]) { dataUiDfObject.LabelTextWidth = UiConstants.LabelTextWidthDefault; dataUiDfObject.TableName = "PROVEE2"; } else if (dataUiDfObject.DataField == UpperPartFields[2]) { dataUiDfObject.TextContentWidth = UiConstants.TextBoxWidthSmall; } DataTable table = new DataTable(); dataUiDfObject.ItemSource = table; observableCollection.Add(dataUiDfObject); } IUiObject objectType = BuildUiSupplierTypeObject(assistQuery, changedField); observableCollection.Add(objectType); collect.Add(MasterModuleConstants.UiUpperPart, observableCollection); return(collect); }
private void IniOb() { observerPlayerBackImage = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("observerPlayer/allKillInfoObserverPlayerBack.atf"), 700, 84); _uiObject.AddChild(observerPlayerBackImage); observerPlayerBackImage.x = 73; observerPlayerBackImage.y = 0; var index = 0; for (var i = 0; i < ObserverPlayerH; ++i) { for (var j = 0; j < ObserverPlayerV; ++j) { var nameObj = UnityUiUtility.CreateEmptyDisplayObject();//UnityUIUtility.CreateImageDisplayObject("1", 128, 32); _uiObject.AddChild(nameObj); observerPlayerName.Add(nameObj); nameObj.x = (observerPlayerBackImage.x + 15 + j * 130); nameObj.y = (observerPlayerBackImage.y + 20 + i * 20); nameObj.visible = false; index++; } } }
private void IniExp() { profitBackImage = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("killList/profitback.atf"), 845, 142); _uiObject.AddChild(profitBackImage); profitBackImage.x = 0; profitBackImage.y = 0; profitBackImage.visible = false; totalExpSprite = UnityUiUtility.CreateEmptyDisplayObject(); _uiObject.AddChild(totalExpSprite); totalExpSprite.x = profitBackImage.x + 110; totalExpSprite.y = profitBackImage.y + 47; totalExpSprite.visible = false; totalExpPerSprite = UnityUiUtility.CreateEmptyDisplayObject(); _uiObject.AddChild(totalExpPerSprite); totalExpPerSprite.x = totalExpSprite.x + 80; totalExpPerSprite.y = totalExpSprite.y + 3; totalExpPerSprite.visible = false; totalGpSprite = UnityUiUtility.CreateEmptyDisplayObject(); _uiObject.AddChild(totalGpSprite); totalGpSprite.x = totalExpSprite.x + 325; totalGpSprite.y = profitBackImage.y + 45; totalGpSprite.visible = false; totalGpPerSprite = UnityUiUtility.CreateEmptyDisplayObject(); _uiObject.AddChild(totalGpPerSprite); totalGpPerSprite.x = totalGpSprite.x + 80; totalGpPerSprite.y = totalGpSprite.y + 3; totalGpPerSprite.visible = false; totalCrystalSprite = UnityUiUtility.CreateEmptyDisplayObject(); _uiObject.AddChild(totalCrystalSprite); totalCrystalSprite.x = profitBackImage.x + 770; totalCrystalSprite.y = profitBackImage.y + 76; totalCrystalSprite.visible = false; // for (var i = 0; i < 4; ++i) // // { totalExpSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(120)); totalExpPerSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(130)); totalGpSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(120)); totalGpPerSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(130)); totalCrystalSprite.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(120)); // } expImageList = new List <IUiObject>(); expSpriteList = new List <IUiObject>(); for (var i = 0; i < 6; ++i) { var expImageObj = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("killList/honorary.atf"), 40, 49); expImageList.Add(expImageObj); _uiObject.AddChild(expImageObj); expImageObj.x = profitBackImage.x + 50 + (expImageObj.width + 10) * i; expImageObj.y = profitBackImage.y + 85; expImageObj.visible = false; var expSpriteObj = UnityUiUtility.CreateEmptyDisplayObject(); expSpriteList.Add(expSpriteObj); _uiObject.AddChild(expSpriteObj); expSpriteObj.x = expImageObj.x + 2; expSpriteObj.y = expImageObj.y + 35; expSpriteObj.visible = false; // for (var j = 0; j < 4; ++j) // { expSpriteObj.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(140)); // } } gpImageList = new List <IUiObject>(); gpSpriteList = new List <IUiObject>(); for (var i = 0; i < 4; ++i) { var gpImageObj = UnityUiUtility.CreateImageDisplayObject(GetCommonUrl("killList/honorary.atf"), 100, 100); gpImageList.Add(gpImageObj); _uiObject.AddChild(gpImageObj); gpImageObj.x = profitBackImage.x + 420 + (gpImageObj.width + 10) * i; gpImageObj.y = profitBackImage.y + 85; gpImageObj.visible = false; var gpSpriteObj = UnityUiUtility.CreateEmptyDisplayObject(); gpSpriteList.Add(gpSpriteObj); _uiObject.AddChild(gpSpriteObj); gpSpriteObj.x = gpImageObj.x + 2; gpSpriteObj.y = gpImageObj.y + 35; gpSpriteObj.visible = false; // for (var j = 0; j < 4; ++j) // // { gpSpriteObj.AddChild(UnityUiUtility.CreateNumberTextDisplayObject(140)); // } } expUrlList = new List <string>(); expUrlList.Add("killList/honorary.atf"); expUrlList.Add("killList/heroweapon.atf"); expUrlList.Add("killList/bigexp.atf"); expUrlList.Add("killList/smallexp.atf"); expUrlList.Add("killList/friend.atf"); expUrlList.Add("killList/accessory.atf"); gpUrlList = new List <string>(); gpUrlList.Add("killList/honorary.atf"); gpUrlList.Add("killList/heroweapon.atf"); gpUrlList.Add("killList/biggp.atf"); gpUrlList.Add("killList/smallgp.atf"); }
public ObservableCollection <IUiObject> BuildLeftPartCollection( UiDualDfSearchTextObject.OnAssistQueryRequestHandler assistQuery, UiDfObject.ChangedField changedField) { ObservableCollection <IUiObject> observableCollection = new ObservableCollection <IUiObject>(); IDictionary <string, ObservableCollection <IUiObject> > dictionary = new Dictionary <string, ObservableCollection <IUiObject> >(); // Nombre y Nif. IUiObject currentField = null; IDictionary <string, string> nameNifDictionary = new Dictionary <string, string>(); nameNifDictionary["DataField"] = LeftPartsFields[0]; nameNifDictionary["DataFieldRight"] = LeftPartsFields[1]; nameNifDictionary["TableName"] = "COMISIO"; nameNifDictionary["PrimaryKey"] = "NUM_COMI"; nameNifDictionary["LabelRight"] = ProviderConstants.LeftPartLabel[0]; nameNifDictionary["Label"] = ProviderConstants.LeftPartLabel[1]; currentField = BuildDoubleDfObjectProviders(nameNifDictionary, changedField); observableCollection.Add(currentField); // Direccion IDictionary <string, string> dirDictionary = new Dictionary <string, string>(); dirDictionary["DataField"] = LeftPartsFields[2]; dirDictionary["Label"] = ProviderConstants.LeftPartLabel[2]; dirDictionary["PrimaryKey"] = "NUM_COMI"; nameNifDictionary["TableName"] = "COMISIO"; currentField = BuildDirection(dirDictionary, changedField); observableCollection.Add(currentField); // Code postal y poblacion currentField = BuildCpPoblacion(assistQuery, changedField); observableCollection.Add(currentField); // Provincia currentField = BuildProvinceDfSearchTextObject("PROVINCIA", assistQuery, changedField); observableCollection.Add(currentField); // Country currentField = BuildPaisSearchTextObject("NACIOPER", assistQuery, changedField); observableCollection.Add(currentField); // Telefono currentField = BuildPhone(changedField); observableCollection.Add(currentField); // Web currentField = BuildField(12, changedField); observableCollection.Add(currentField); // Email IDictionary <string, string> fields = new Dictionary <string, string>(); fields["DataField"] = "EMAIL"; fields["Label"] = "Email"; fields["PrimaryKey"] = "NUM_COMI"; fields["Table"] = "COMISIO"; currentField = BuildEmail(fields, EmailCheckHandler, changedField); observableCollection.Add(currentField); // Persona currentField = BuildField(13, changedField); observableCollection.Add(currentField); // Officina currentField = BuildOffice(assistQuery, changedField); observableCollection.Add(currentField); // Dates. currentField = BuildDates(changedField); observableCollection.Add(currentField); // add notes currentField = BuildDataArea(changedField, LeftPartsFields[18], ProviderConstants.LeftPartLabel[18]); observableCollection.Add(currentField); return(observableCollection); }
public IDictionary <string, ObservableCollection <IUiObject> > BuildPageObjects(UiDualDfSearchTextObject.OnAssistQueryRequestHandler assistQuery, UiDfObject.ChangedField changedField) { ObservableCollection <IUiObject> observableCollection = new ObservableCollection <IUiObject>(); IDictionary <string, ObservableCollection <IUiObject> > dictionary = new Dictionary <string, ObservableCollection <IUiObject> >(); IDictionary <string, string> currentParam = new Dictionary <string, string>(); // add a name currentParam.Add("DataField", MiddlePartsFields[0]); currentParam.Add("Label", Resources.Nombre); currentParam.Add("Table", "PROVEE1"); currentParam.Add("PrimaryKey", ProviderConstants.PrimaryKey); //add a nif currentParam.Add("LabelRight", Resources.NIF); currentParam.Add("DataFieldRight", MiddlePartsFields[1]); IUiObject currentField = BuildDoubleDfObjectProviders(currentParam, changedField); observableCollection.Add(currentField); // Direcion1 currentParam["DataField"] = MiddlePartsFields[2]; currentParam["Label"] = "Direccion"; currentParam["Table"] = "PROVEE1"; currentParam["PrimaryKey"] = ProviderConstants.PrimaryKey; currentField = BuildDirection(currentParam, changedField); observableCollection.Add(currentField); currentParam["DataField"] = MiddlePartsFields[2]; currentParam["Label"] = Resources.Dirección2; currentParam["Table"] = "PROVEE1"; currentParam["PrimaryKey"] = ProviderConstants.PrimaryKey; currentField = BuildDirection(currentParam, changedField); observableCollection.Add(currentField); // add a cp poblacion currentField = BuildCpPoblacion(assistQuery, changedField); observableCollection.Add(currentField); // build province currentField = BuildProvinceDfSearchTextObject(MiddlePartsFields[6], assistQuery, changedField); observableCollection.Add(currentField); currentField = BuildPaisSearchTextObject(MiddlePartsFields[7], assistQuery, changedField); observableCollection.Add(currentField); // add phone. currentField = BuildPhone(changedField); observableCollection.Add(currentField); // add internet. currentField = BuildField(12, changedField); observableCollection.Add(currentField); // add the current field. IDictionary <string, string> currentEmailParam = new Dictionary <string, string>(); currentEmailParam.Add("DataField", Email); currentEmailParam.Add("Label", Resources.Email); currentEmailParam.Add("Table", "PROVEE1"); currentEmailParam.Add("PrimaryKey", ProviderConstants.PrimaryKey); currentField = BuildEmail(currentEmailParam, this.EmailCheckHandler, changedField); observableCollection.Add(currentField); // add persona currentField = BuildField(13, changedField); observableCollection.Add(currentField); currentField = BuildOffice(assistQuery, changedField); observableCollection.Add(currentField); // add dates currentField = BuildDates(changedField); observableCollection.Add(currentField); // add notes currentField = BuildDataArea(changedField, MiddlePartsFields[18], ProviderConstants.LeftPartLabel[18]); observableCollection.Add(currentField); // add observa currentField = BuildDataArea(changedField, MiddlePartsFields[19], ProviderConstants.LeftPartLabel[19]); observableCollection.Add(currentField); dictionary.Add(MasterModuleConstants.UiMiddlePartPage, observableCollection); return(dictionary); }
// protected void setArabicNumberTexCood(int number,Image image,int index) // { // var textureChangeManager:UITextureChangeManager = GameGUIManager.getInstance().getTextureChangeManager(); //var pointList:Vector.<Point> = textureChangeManager.getTexCoodPoint( index+number ); // for( var i:int = 0; i< 4; i++ ) // { // image.setTexCoords( i, pointList[i] ); // } // } // protected function setImageTexCoordsXY(origWidth:int, origHeight:int, image:Image):void // { // var legalWidth:int = TextureUtils.getNextPowerOfTwo(origWidth); // var legalHeight:int = TextureUtils.getNextPowerOfTwo(origHeight); // // image.setTexCoordsXY( 1, origWidth/legalWidth, 0 ); // image.setTexCoordsXY( 2, 0, origHeight/legalHeight ); // image.setTexCoordsXY( 3, origWidth/legalWidth, origHeight/legalHeight ); // } protected void SetNumber(IUiObject sprite, int number) { var text = sprite.FindComponentInChildren <UnityEngine.UI.Text>(); text.text = number.ToString(); }
// 相对位置 0位左上,1位右上,2位左下,3位右下,4位中间左上,5位中间右上,6位中间左下,7位中间右下 private void SetXy(IUiObject control, int relative, float startX, float startY, int width, int height, float x, float y) { switch (relative) { case 0: control.x = startX + x; control.y = startY + y; break; case 1: control.x = startX + width - x; control.y = startY + y; break; case 2: control.x = startX + x; control.y = startY + height - y; break; case 3: control.x = startX + width - x; control.y = startY + height - y; break; case 4: control.x = startX + width / 2 - x; control.y = startY + height / 2 - y; break; case 5: control.x = startX + width / 2 + x; control.y = startY + height / 2 - y; break; case 6: control.x = startX + width / 2 - x; control.y = startY + height / 2 + y; break; case 7: control.x = startX + width / 2 + x; control.y = startY + height / 2 + y; break; case 8: control.x = startX + width / 2 - x; control.y = startY + y; break; case 9: control.x = startX + width / 2 - x; control.y = startY + height - y; break; case 10: control.x = startX + x; control.y = startY + height / 2 - y; break; case 11: control.x = startX + width - x; control.y = startY + height / 2 - y; break; default: break; } }
/// <summary> /// Build a query from user objects. Each user object has a part of the query. /// </summary> /// <param name="list">List of the userobject to be analized</param> /// <param name="primaryKeyValue">Primary key that it needs to be used, optional</param> /// <param name="isInsert"></param> /// <returns></returns> public static IDictionary <string, string> SqlBuildSelectFromUiObjects(ObservableCollection <IUiObject> list, string primaryKeyValue = "", bool isInsert = false) { IDictionary <string, StringBuilder> tableDictionary = new Dictionary <string, StringBuilder>(); IDictionary <string, string> primaryKeys = new Dictionary <string, string>(); IDictionary <string, string> tableWithQuery = new Dictionary <string, string>(); IDictionary <string, object> dataFields = new Dictionary <string, object>(); IList <string> queryList = new List <string>(); foreach (IUiObject obj in list) { IUiObject tmpUiObject = obj; if (obj.TableName != null) { if (string.IsNullOrEmpty(obj.TableName)) { continue; } if (obj is UiMultipleDfObject) { ObservableCollection <IUiObject> objectValues = ((UiMultipleDfObject)obj).Values; foreach (IUiObject objValue in objectValues) { if (!tableDictionary.ContainsKey(objValue.TableName)) { tableDictionary[objValue.TableName] = new StringBuilder(); primaryKeys[objValue.TableName] = objValue.PrimaryKey; } StringBuilder currentStringBuilder = tableDictionary[objValue.TableName]; if (!currentStringBuilder.ToString().Contains(objValue.ToSQLString)) { tableDictionary[objValue.TableName].Append(objValue.ToSQLString); } } } else { if (!tableDictionary.ContainsKey(obj.TableName)) { tableDictionary[obj.TableName] = new StringBuilder(); primaryKeys[obj.TableName] = obj.PrimaryKey; } StringBuilder currentStringBuilder = tableDictionary[obj.TableName]; if (!currentStringBuilder.ToString().Contains(obj.ToSQLString)) { tableDictionary[obj.TableName].Append(obj.ToSQLString); } // tableDictionary[obj.TableName].Append(obj.ToSQLString); } } } foreach (var key in tableDictionary.Keys) { tableDictionary[key][tableDictionary[key].Length - 1] = ' '; } string modifiedKey = ""; StringBuilder newBuilder = null; foreach (var key in tableDictionary.Keys) { StringBuilder current = tableDictionary[key]; IEnumerable <string> values = current.ToString().Split(',').Distinct(); current.Clear(); foreach (string v in values) { current.Append(v); current.Append(","); } tableDictionary[key][tableDictionary[key].Length - 1] = ' '; string tmp = current.ToString(); if (!tmp.Contains(primaryKeys[key])) { newBuilder = new StringBuilder(); newBuilder.Append(tmp); newBuilder.Append(","); newBuilder.Append(primaryKeys[key]); modifiedKey = key; newBuilder.Append(","); } } if (newBuilder != null) { tableDictionary[modifiedKey] = newBuilder; } foreach (var key in tableDictionary.Keys) { tableDictionary[key][tableDictionary[key].Length - 1] = ' '; } foreach (var key in tableDictionary.Keys) { StringBuilder builder = new StringBuilder(); builder.Append("SELECT "); if (isInsert) { builder.Append(TopOne); } builder.Append(tableDictionary[key]); builder.Append(" FROM "); builder.Append(key); if (!isInsert) { if (!string.IsNullOrEmpty(primaryKeyValue)) { // if it is not null builder.Append(" WHERE " + primaryKeys[key]); builder.Append("=\'" + primaryKeyValue + "\'"); } } queryList.Add(builder.ToString()); tableWithQuery[key] = builder.ToString().Replace(",,", ","); } return(tableWithQuery); }