public void ApplyModel(iComponentModel data) { currentNPC = playerManager.NPCLookingAt(); model = data as ScreenNPCInteractionModel; nameText.SetText(model.name); IconStateButtonModel[] startModelList = new IconStateButtonModel[] { new IconStateButtonModel(ScreenNPCInteractionSignals.removeRouteStart, startButtonStyles[0]), new IconStateButtonModel(ScreenNPCInteractionSignals.setRouteStart, startButtonStyles[1]) }; startButton.Create(startModelList); startButton.ForceState(Convert.ToInt32(model.routeDestination != null)); IconStateButtonModel[] destinationModelList = new IconStateButtonModel[] { new IconStateButtonModel(ScreenNPCInteractionSignals.removeRouteDestination, destinationButtonStyles[1]), new IconStateButtonModel(ScreenNPCInteractionSignals.setRouteDestination, destinationButtonStyles[0]) }; destinationButton.Create(destinationModelList); destinationButton.ForceState(Convert.ToInt32(model.routeDestination != null)); IconStateButtonModel[] toggleModelList = new IconStateButtonModel[] { new IconStateButtonModel(ScreenNPCInteractionSignals.pauseRoutes, toggleStateButtonStyles[1]), new IconStateButtonModel(ScreenNPCInteractionSignals.runRoutes, toggleStateButtonStyles[0]) }; toggleStateButton.Create(toggleModelList); toggleStateButton.ForceState(Convert.ToInt32(currentNPC.routeManager.running)); }
public void ConstructViewModel() { if (playerManager.NPCLookingAt() != null) { npc = playerManager.NPCLookingAt(); } model = new ScreenNPCInteractionModel() { name = npc.model.name }; if (npc.model.commands.Count > 0 && npc.model.commands[0] != null) { model.routeStart = npc.model.commands[0].gameObject.transform; } if (npc.model.commands.Count > 1 && npc.model.commands[1] != null) { model.routeDestination = npc.model.commands[1].gameObject.transform; } Debug.Log("COnstruct View model for: " + npc.model.name); view.ApplyModel(model); }