private void UpdateMapResources() { extElems = getAllElements(); // Put the elements into the map map.Geometries = mapScene.Elements .FindAll(e => e is GeoReference) .ConvertAll(e => FindGeoElem(e.getTargetId()).Geometry); var allElements = mapScene.Elements .FindAll(e => e is ExtElemReference) .ConvertAll(e => e as ExtElemReference); positionManagers.Clear(); foreach (var elem in allElements) { // Create the positionManager based on the descriptor var guiMapPositionManager = ExtElemReferenceGUIMapPositionManagerFactory.Instance.CreateInstance(elem.TransformManagerDescriptor, elem); positionManagers.Add(elem, guiMapPositionManager); // Look for the texture var extElem = FindExtElem(elem.getTargetId()); var previewImage = extElem.GetType().GetMethod("getPreviewImage"); if (previewImage != null) { var image = previewImage.Invoke(extElem, null) as string; if (image != null) { guiMapPositionManager.Texture = AssetsController.getImage(image).texture; } } } // Update the positioned resources map.PositionedResources = positionManagers.Values.ToList(); }
public void addPlayer() { if (sceneDataControl.isForcedPlayerLayer()) { playerImagePath = Controller.getInstance().getPlayerImagePath(); ElementContainer ec = new ElementContainer(null, 0, AssetsController.getImage(this.playerImagePath)); int layer = insertInOrder(ec, true); reassignLayerAllReferencesDataControl(layer); sceneDataControl.setPlayerLayer(layer); } }
public void OnDialogOk(string message, object workingObject = null, object workingObjectSecond = null) { switch ((BaseFileOpenDialog.FileType)workingObject) { case BaseFileOpenDialog.FileType.ITEM_IMAGE: element.Image = message; Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[ GameRources.GetInstance().selectedSceneIndex].setPreviewBackground(message); if (element.Image != null && !element.Image.Equals("")) imagePreview = AssetsController.getImage(element.Image).texture; break; } }
public Sprite getPlayerImage() { //CHANGE: Now, the image of the player must be taken from return(AssetsController.getImage(Controller.getInstance().getPlayerImagePath())); /*if (playerPositionInAllReferences==NO_PLAYER) * return AssetsController.getImage(Controller.getInstance().getPlayerImagePath()); * else{ * if (imagePathHasChanged){ * allReferencesDataControl.get(playerPositionInAllReferences).setImage(AssetsController.getImage( this.playerImagePath )); * imagePathHasChanged = false; * } * // if (allReferences!=null) * return allReferencesDataControl.get(playerPositionInAllReferences).getImage(); * }*/ }
public Sprite getImageFromPath(string uri) { return(AssetsController.getImage(uri)); }
public void changeImagePlayerPath(string imagePath) { this.playerImagePath = imagePath; this.imagePathHasChanged = true; if (allReferencesDataControl.Count == 0) { playerPositionInAllReferences = 0; reassignLayerAllReferencesDataControl(insertInOrder(new ElementContainer(null, 0, AssetsController.getImage(this.playerImagePath)), true)); } }
// this function was made to insert player in correct position in SwapPlayerModeTool // CAUTION!! dont check if has layer or if it is allowed, because where it is call that has been checked // dont call to setPlayerLayer() because it has been checked public void restorePlayer() { ElementContainer ec = new ElementContainer(null, sceneDataControl.getPlayerLayer(), AssetsController.getImage(this.playerImagePath)); int layer = insertInOrder(ec, true); reassignLayerAllReferencesDataControl(layer); }
/** * Constructor. * * @param sceneDataControl * Link to the parent scene controller * @param itemReferencesList * List of item references */ public ReferencesListDataControl(string playerImagePath, SceneDataControl sceneDataControl, List <ElementReference> itemReferencesList, List <ElementReference> atrezzoReferencesList, List <ElementReference> npcReferencesList) { this.playerImagePath = playerImagePath; this.sceneDataControl = sceneDataControl; this.itemReferencesList = itemReferencesList; this.atrezzoReferencesList = atrezzoReferencesList; this.npcReferencesList = npcReferencesList; this.allReferencesDataControl = new List <ElementContainer>(); this.lastElementContainer = null; this.playerPositionInAllReferences = NO_PLAYER; this.imagePathHasChanged = false; // Check if one of references has layer -1: if it is true, it means that element references has no layer. // Create subcontrollers bool hasLayerV = hasLayer(); foreach (ElementReference itemReference in itemReferencesList) { int counter = count(itemReference); ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, itemReference, Controller.ITEM_REFERENCE, counter); insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV); } foreach (ElementReference atrezzoReference in atrezzoReferencesList) { int counter = count(atrezzoReference); ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, atrezzoReference, Controller.ATREZZO_REFERENCE, counter); insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV); } foreach (ElementReference npcReference in npcReferencesList) { int counter = count(npcReference); ElementReferenceDataControl erdc = new ElementReferenceDataControl(sceneDataControl, npcReference, Controller.NPC_REFERENCE, counter); insertInOrder(new ElementContainer(erdc, -1, null), hasLayerV); } // insert player // by default, if player donĀ“t have layer, we give it to him. if (playerImagePath != null && (!Controller.getInstance().isPlayTransparent()) && sceneDataControl.isForcedPlayerLayer()) { int layer; if (sceneDataControl.getPlayerLayer() == Scene.PLAYER_WITHOUT_LAYER) { layer = 0; } else { layer = sceneDataControl.getPlayerLayer(); } reassignLayerAllReferencesDataControl(insertInOrder(new ElementContainer(null, layer, AssetsController.getImage(this.playerImagePath)), true)); } }