Inheritance: MonoBehaviour
コード例 #1
0
 public static void Initialize(
     DisplayedDevice displayedDeviceScript
     , Device device
     , DevicesDisplayer devicesDisplayer
     , DevicesDisplayer.DeviceType deviceType
     )
 {
     if (device == null)
     {
         Logger.Log("DisplayedDevice::Initialize device==null", Logger.Level.WARN);
     }
     Logger.Log("DisplayedDevice::Initialize(" + displayedDeviceScript + ", " + device + ", " + devicesDisplayer + ", " + deviceType + ") starts", Logger.Level.DEBUG);
     displayedDeviceScript._device = Device.buildDevice(device);
     if (displayedDeviceScript._device == null)
     {
         Logger.Log("DisplayedDevice::Initialize _device==null", Logger.Level.WARN);
     }
     Logger.Log("DisplayedDevice::Create built device " + displayedDeviceScript._device + " from " + device, Logger.Level.TRACE);
     if (_devicesDisplayer == null)
     {
         _devicesDisplayer = DevicesDisplayer.get();
     }
     displayedDeviceScript._deviceType = deviceType;
     Logger.Log("DisplayedDevice::Initialize ends", Logger.Level.TRACE);
 }
コード例 #2
0
 public static DevicesDisplayer get() {
   if(_instance == null) {
     Logger.Log("DevicesDisplayer::get was badly initialized", Logger.Level.WARN);
     _instance = GameObject.Find(gameObjectName).GetComponent<DevicesDisplayer>();
   }
   return _instance;
 }
コード例 #3
0
 void Start()
 {
   if(null == _devicesDisplayer)
   {
     _devicesDisplayer = DevicesDisplayer.get();
   }
 }
コード例 #4
0
 void Start()
 {
     if (null == _devicesDisplayer)
     {
         _devicesDisplayer = DevicesDisplayer.get();
     }
 }
コード例 #5
0
    void initIfNecessary()
    {
        Logger.Log("EquipedDisplayedDevice::initIfNecessary starts", Logger.Level.INFO);
        if (
            (null == equipedDevice) ||
            (null == tinyBioBrickIcon) ||
            (null == tinyBioBrickIcon2) ||
            (0 == _tinyIconVerticalShift) ||
            (0 == _width)
            )
        {
            equipedDevice = DevicesDisplayer.get().equipedDevice;

            tinyBioBrickIcon  = GameObject.Find("InterfaceLinkManager").GetComponent <InterfaceLinkManager>().tinyBioBrickIconPrefabPos;
            tinyBioBrickIcon2 = GameObject.Find("InterfaceLinkManager").GetComponent <InterfaceLinkManager>().tinyBioBrickIconPrefabPos2;
        }

        if (null != tinyBioBrickIcon)
        {
            if (null != equipedDevice)
            {
                _tinyIconVerticalShift = (tinyBioBrickIcon.transform.localPosition - equipedDevice.transform.localPosition).y;
            }
            if (null != tinyBioBrickIcon2)
            {
                _width = tinyBioBrickIcon2.transform.localPosition.x - tinyBioBrickIcon.transform.localPosition.x;
                tinyBioBrickIcon.SetActive(false);
                tinyBioBrickIcon2.SetActive(false);
            }
            Logger.Log("EquipedDisplayedDevice::initIfNecessary ends", Logger.Level.INFO);
        }
    }
コード例 #6
0
 protected DevicesDisplayer safeGetDisplayer()
 {
     if (_displayer == null)
     {
         _displayer = DevicesDisplayer.get();
     }
     return(_displayer);
 }
コード例 #7
0
ファイル: DeviceContainer.cs プロジェクト: CyberCRI/Hero.Coli
 protected DevicesDisplayer safeGetDisplayer()
 {
   if(_displayer == null)
   {
     _displayer = DevicesDisplayer.get();
   }
   return _displayer;
 }
コード例 #8
0
    public static DisplayedDevice Create(
        Transform parentTransform
        , Vector3 localPosition
        , string spriteName
        , Device device
        , DevicesDisplayer devicesDisplayer
        , DevicesDisplayer.DeviceType deviceType
        )
    {
        if (device == null)
        {
            Logger.Log("DisplayedDevice::Create device==null", Logger.Level.WARN);
        }

        string nullSpriteName = (spriteName != null)?"":"(null)";
        Object prefab;

        if (deviceType == DevicesDisplayer.DeviceType.Equiped)
        {
            Logger.Log("DisplayedDevice: will create Equiped " + equipedPrefabURI, Logger.Level.DEBUG);
            prefab = Resources.Load(equipedPrefabURI);
        }
        else if (deviceType == DevicesDisplayer.DeviceType.Inventoried)
        {
            Logger.Log("DisplayedDevice: will create Inventoried " + inventoriedPrefabURI, Logger.Level.DEBUG);
            prefab = Resources.Load(inventoriedPrefabURI);
        }
        else if (deviceType == DevicesDisplayer.DeviceType.Listed)
        {
            Logger.Log("DisplayedDevice: will create Listed " + listedPrefabURI, Logger.Level.DEBUG);
            prefab = Resources.Load(listedPrefabURI);
        }
        else
        {
            Logger.Log("DisplayedDevice::Create : unmanaged device type " + deviceType, Logger.Level.WARN);
            return(null);
        }

        Logger.Log("DisplayedDevice::Create(type=" + deviceType
                   + ", parentTransform=" + parentTransform
                   + ", localPosition=" + localPosition
                   + ", device=" + device
                   + ", devicesDisplayer=" + devicesDisplayer
                   + ", spriteName=" + spriteName + nullSpriteName
                   , Logger.Level.DEBUG
                   );

        DisplayedDevice result = (DisplayedDevice)DisplayedElement.Create(
            parentTransform
            , localPosition
            , getTextureName(device)
            , prefab
            );

        Initialize(result, device, devicesDisplayer, deviceType);

        return(result);
    }
コード例 #9
0
 public static DevicesDisplayer get()
 {
     if (_instance == null)
     {
         Logger.Log("DevicesDisplayer::get was badly initialized", Logger.Level.WARN);
         _instance = GameObject.Find(gameObjectName).GetComponent <DevicesDisplayer>();
     }
     return(_instance);
 }
コード例 #10
0
ファイル: GUITransitioner.cs プロジェクト: CyberCRI/Hero.Coli
	public ArrowAnimationManager arrowManager;		//Manager for the arrow Animation
	
	// Use this for initialization
	void Start () {

    _reactionEngine = ReactionEngine.get();
    _devicesDisplayer = DevicesDisplayer.get();

		SetScreen2(false);
		SetScreen3(false);
		SetScreen1(true);
		
		
		_devicesDisplayer.UpdateScreen();
		_currentScreen = GameScreen.screen1;
		
		_timeAtLastFrame = Time.realtimeSinceStartup;

		arrowManager = new ArrowAnimationManager();
	}
コード例 #11
0
    public ArrowAnimationManager arrowManager;                  //Manager for the arrow Animation

    // Use this for initialization
    void Start()
    {
        _reactionEngine   = ReactionEngine.get();
        _devicesDisplayer = DevicesDisplayer.get();

        SetScreen2(false);
        SetScreen3(false);
        SetScreen1(true);


        _devicesDisplayer.UpdateScreen();
        _currentScreen = GameScreen.screen1;

        _timeAtLastFrame = Time.realtimeSinceStartup;

        arrowManager = new ArrowAnimationManager();
    }
コード例 #12
0
    public static string getTextureName(Device device)
    {
        string usedSpriteName = baseDeviceTextureString;

        DevicesDisplayer.TextureQuality quality = DevicesDisplayer.getTextureQuality();

        switch (quality)
        {
        case DevicesDisplayer.TextureQuality.HIGH:
            usedSpriteName += quality256;
            break;

        case DevicesDisplayer.TextureQuality.NORMAL:
            usedSpriteName += quality80;
            break;

        case DevicesDisplayer.TextureQuality.LOW:
            usedSpriteName += quality64;
            break;

        default:
            usedSpriteName += qualityDefault;
            break;
        }

        if (null == device)
        {
            usedSpriteName += getTextureName("");
        }
        else
        {
            usedSpriteName += getTextureName(device.getFirstGeneProteinName());
        }

        if (quality == DevicesDisplayer.TextureQuality.LOW)
        {
            usedSpriteName += getLevelPostfix(device);
        }

        Logger.Log("DisplayedDevice::getTextureName usedSpriteName=" + usedSpriteName, Logger.Level.TRACE);
        return(usedSpriteName);
    }
コード例 #13
0
    public static DisplayedDevice Create(
		Transform parentTransform, 
		Vector3 localPosition, 
		int deviceID, 
		DevicesDisplayer.DeviceType deviceType,
		DeviceInfo deviceInfo,
		DevicesDisplayer devicesDisplayer
		)
    {
        Debug.Log("create device "+deviceID
        + " parentTransform="+parentTransform
        + " localPosition="+localPosition
        + " deviceType="+deviceType
        + "deviceInfo="+deviceInfo
        + "devicesDisplayer="+devicesDisplayer);

        GameObject newDevice = Instantiate(prefab, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity) as GameObject;
        newDevice.transform.parent = parentTransform;
        newDevice.transform.localPosition = localPosition;
        newDevice.transform.localScale = new Vector3(1f, 1f, 0);

        DisplayedDevice deviceScript = newDevice.GetComponent<DisplayedDevice>();
        deviceScript._deviceID = deviceID;
        deviceScript._deviceType = deviceType;
        deviceScript._deviceInfo = deviceInfo;
        deviceScript._devicesDisplayer = devicesDisplayer;
        deviceScript._currentSpriteName = deviceInfo._spriteName;
        /*
        //deviceScript._sprite = newDevice.transform.GetComponentInChildren<UISprite>();
        GameObject background = newDevice.transform.Find("Background").gameObject;
        if(background) {
            deviceScript._sprite = background.GetComponent<UISprite>();
            Debug.Log("init _sprite as "+deviceScript._sprite);
        } else {
            Debug.Log("init _sprite impossible: no background found");
        }
        */

        //do additional initialization steps here

        return deviceScript;
    }
コード例 #14
0
ファイル: DisplayedDevice.cs プロジェクト: CyberCRI/Hero.Coli
  public static void Initialize(
    DisplayedDevice displayedDeviceScript
    , Device device
    , DevicesDisplayer devicesDisplayer
    , DevicesDisplayer.DeviceType deviceType
    ) {

    if(device == null)
    {
      Logger.Log("DisplayedDevice::Initialize device==null", Logger.Level.WARN);
    }
    Logger.Log("DisplayedDevice::Initialize("+displayedDeviceScript+", "+device+", "+devicesDisplayer+", "+deviceType+") starts", Logger.Level.DEBUG);
    displayedDeviceScript._device = Device.buildDevice(device);
    if(displayedDeviceScript._device==null)
    {
      Logger.Log("DisplayedDevice::Initialize _device==null", Logger.Level.WARN);
    }
    Logger.Log("DisplayedDevice::Create built device "+displayedDeviceScript._device+" from "+device, Logger.Level.TRACE);
    if(_devicesDisplayer == null)
    {
      _devicesDisplayer = DevicesDisplayer.get();
    }
    displayedDeviceScript._deviceType = deviceType;
    Logger.Log("DisplayedDevice::Initialize ends", Logger.Level.TRACE);

  }
コード例 #15
0
 void Awake()
 {
   Logger.Log("DevicesDisplayer::Awake", Logger.Level.DEBUG);
   _instance = this;
 }
コード例 #16
0
    public void removeDevice (DevicesDisplayer.DeviceType type, Device toRemove)
    {
        List<DisplayedDevice> devices;
        DisplayedDevice found;
        if (type == DevicesDisplayer.DeviceType.Equiped) {
            devices = _equipedDevices;
        } else if (type == DevicesDisplayer.DeviceType.Inventoried) {
            devices = _inventoriedDevices;
        } else if (type == DevicesDisplayer.DeviceType.Listed) {
            devices = _listedInventoriedDevices;
        } else {
            Logger.Log ("DevicesDisplayer::removeDevice unknown type="+type, Logger.Level.WARN);
            devices = new List<DisplayedDevice>();
        }
        found = devices.Find (device => device._device.Equals (toRemove));

        if (found != null) {
            removeDevice (found, devices, type);
        } else {
            Logger.Log ("removeDevice(type=" + type + ", toRemove=" + toRemove + ") found no matching device", Logger.Level.WARN);
        }
    }
コード例 #17
0
ファイル: DisplayedDevice.cs プロジェクト: CyberCRI/Hero.Coli
	public static DisplayedDevice Create(
		Transform parentTransform
		, Vector3 localPosition
    , string spriteName
		, Device device
		, DevicesDisplayer devicesDisplayer
    , DevicesDisplayer.DeviceType deviceType
		)
	{

    if(device == null)
    {
      Logger.Log ("DisplayedDevice::Create device==null", Logger.Level.WARN);
    }

    string nullSpriteName = (spriteName!=null)?"":"(null)";
    Object prefab;
    if (deviceType == DevicesDisplayer.DeviceType.Equiped) {
            Logger.Log("DisplayedDevice: will create Equiped "+equipedPrefabURI, Logger.Level.DEBUG);
      prefab = Resources.Load(equipedPrefabURI);
    } else if (deviceType == DevicesDisplayer.DeviceType.Inventoried) {
            Logger.Log("DisplayedDevice: will create Inventoried "+inventoriedPrefabURI, Logger.Level.DEBUG);
      prefab = Resources.Load(inventoriedPrefabURI);
    } else if (deviceType == DevicesDisplayer.DeviceType.Listed) {
            Logger.Log("DisplayedDevice: will create Listed "+listedPrefabURI, Logger.Level.DEBUG);
      prefab = Resources.Load(listedPrefabURI);
    } else {
      Logger.Log("DisplayedDevice::Create : unmanaged device type "+deviceType, Logger.Level.WARN);
      return null;
    }

		Logger.Log("DisplayedDevice::Create(type="+deviceType
		+ ", parentTransform="+parentTransform
		+ ", localPosition="+localPosition
		+ ", device="+device
		+ ", devicesDisplayer="+devicesDisplayer
    + ", spriteName="+spriteName+nullSpriteName
    , Logger.Level.DEBUG
    );

    DisplayedDevice result = (DisplayedDevice)DisplayedElement.Create(
      parentTransform
      ,localPosition
      ,getTextureName(device)
      ,prefab
      );

    Initialize(result, device, devicesDisplayer, deviceType);

    return result;
	}
コード例 #18
0
    //public Camera _uicamera;


    // Use this for initialization
    void Awake()
    {
        //shortcut
        CraftZoneManager    craftZoneManager    = CraftZoneManager.get();
        GameStateController gameStateController = GameStateController.get();
        //CraftFinalizer _craftfinalizer = craftFinalizer;
        GUITransitioner           guiTransitioner           = GUITransitioner.get();
        DevicesDisplayer          devicesDisplayer          = DevicesDisplayer.get();
        InfoWindowManager         infoWindowManager         = InfoWindowManager.get();
        AvailableBioBricksManager availableBioBricksManager = AvailableBioBricksManager.get();
        TooltipManager            tooltipManager            = TooltipManager.get();
        ModalManager modalManager        = ModalManager.get();
        GameObject   mediumInfoPanelCell = GameObject.Find("MediumInfoPanelCell");

        //GUITransitioner
        guiTransitioner.celliaGraph = mediumInfoPanelCell.transform.Find("CellMediumInfoBackgroundSprite").gameObject
                                      .GetComponent <VectrosityPanel>();
        guiTransitioner.roomGraph = GameObject.Find("MediumInfoPanelRoom").transform.Find("RoomMediumInfoBackgroundSprite").gameObject
                                    .GetComponent <VectrosityPanel>();
        guiTransitioner.animator    = GameObject.Find("WorldEquipButton").GetComponent <InventoryAnimator>();
        guiTransitioner.worldScreen = GameObject.Find("WorldScreensPanel");
        guiTransitioner.craftScreen = craftScreenPanel;

        ContinueButton  cb  = okButton1.GetComponent <ContinueButton>();
        StartGameButton sgb = okButton2.GetComponent <StartGameButton>();

        //GameStateController
        gameStateController.intro = introduction1;
        gameStateController.introContinueButton = cb;
        gameStateController.fadeSprite          = fade;
        gameStateController.endWindow           = end;
        EndMainMenuButton emmb = endMainMenuButton.GetComponent <EndMainMenuButton>();

        gameStateController.endMainMenuButton = emmb;
        gameStateController.mainMenu          = mainMenu;

        //TODO should be done in gameStateController instead
        tutorialPanels.SetActive(true);
        introduction1.SetActive(false);
        introduction2.SetActive(false);
        end.SetActive(false);
        pauseIndicator.SetActive(false);
        genericModalWindow.SetActive(false);

        craftScreenPanel.SetActive(false);

        mainMenu.open();

        gameStateController.pauseIndicator = pauseIndicator;

        //initialization of intro panels
        cb.nextInfoPanel         = introduction2;
        cb.nextInfoPanelContinue = sgb;

        //CraftFinalizer
        craftFinalizer.ToCraftZoneManager = craftZoneManager;

        //CraftZoneManager
        craftZoneManager.GetComponent <CraftZoneManager>().craftFinalizer = craftFinalizer;

        //CraftFinalizer _craftFinalizer2 = CraftZoneManager.get().GetComponent<CraftZoneManager>().craftFinalizer;
        if (null == craftFinalizer.craftFinalizationButton)
        {
            craftFinalizer.craftFinalizationButton = GameObject.Find("CraftButton").GetComponent <CraftFinalizationButton>();
        }

        craftZoneManager.displayedBioBrick      = craftZoneDisplayedBioBrickPrefab;
        craftZoneManager.lastHoveredInfoManager = lastHoveredInfo.GetComponent <LastHoveredInfoManager>();
        craftZoneManager.assemblyZonePanel      = craftScreenPanel.transform.FindChild("TopPanel").transform.FindChild("AssemblyZonePanel").gameObject;


        //DevicesDisplayer

        devicesDisplayer.equipPanel           = equipedDevicesSlotsPanel;
        devicesDisplayer.inventoryPanel       = inventoryDevicesSlotsPanel;
        devicesDisplayer.listedInventoryPanel = craftScreenPanel.transform.FindChild("BottomPanel").transform.FindChild("DevicesPanel").GetComponent <UIPanel>();

        devicesDisplayer.graphMoleculeList = mediumInfoPanelCell.GetComponent <GraphMoleculeList>() as GraphMoleculeList;

        devicesDisplayer.equipedDevice  = equipedDeviceButtonPrefabPos;
        devicesDisplayer.equipedDevice2 = equipedDeviceButtonPrefabPos2;

        devicesDisplayer.inventoryDevice       = inventoryDevicePrefab;
        devicesDisplayer.listedInventoryDevice = listedDevicePrefab;


        //InfoWindowManager
        infoWindowManager.infoPanel        = genericInfoWindow;
        infoWindowManager.titleLabel       = genericInfoWindow.transform.FindChild("TitleLabel").GetComponent <UILocalize>();
        infoWindowManager.subtitleLabel    = genericInfoWindow.transform.FindChild("SubtitleLabel").GetComponent <UILocalize>();
        infoWindowManager.explanationLabel = genericInfoWindow.transform.FindChild("ExplanationLabel").GetComponent <UILocalize>();
        infoWindowManager.bottomLabel      = genericInfoWindow.transform.FindChild("BottomLabel").GetComponent <UILocalize>();
        infoWindowManager.infoSprite       = genericInfoWindow.transform.FindChild("InfoSprite").GetComponent <UISprite>();

        //ModalManager
        modalManager.modalBackground               = modalBackground;
        modalManager.genericModalWindow            = genericModalWindow;
        modalManager.titleLabel                    = genericModalWindow.transform.FindChild("TitleLabel").GetComponent <UILocalize>();
        modalManager.explanationLabel              = genericModalWindow.transform.FindChild("ExplanationLabel").GetComponent <UILocalize>();
        modalManager.infoSprite                    = genericModalWindow.transform.FindChild("InfoSprite").GetComponent <UISprite>();
        modalManager.genericValidateButton         = genericModalWindow.transform.FindChild("ValidateButton").gameObject;
        modalManager.genericCenteredValidateButton = genericModalWindow.transform.FindChild("CenteredValidateButton").gameObject;
        modalManager.genericCancelButton           = genericModalWindow.transform.FindChild("CancelButton").gameObject;


        //DeviceInventory
        Inventory.get().animator = GameObject.Find("WorldEquipButton").GetComponent <InventoryAnimator>();
        Inventory.get().animator.tutorialArrowAnimation = tutorialArrow.GetComponent <ArrowAnimation>();

        //BiobrickInventory

        //AvailableBioBricksManager.get().bioBricksPanel = GameObject.Find("BiobricksPanel");
        availableBioBricksManager.bioBricksPanel    = craftScreenPanel.transform.FindChild("BottomPanel").transform.FindChild("BiobricksPanel").gameObject;
        availableBioBricksManager.availableBioBrick = availableBioBricksManager.bioBricksPanel.transform.FindChild("AvailableDisplayedBioBrickPrefab").gameObject;
        //AvailableBioBricksManager.get ().availableBioBrick = GameObject.Find ("AvailableDisplayedBioBrickPrefab");

        //TooltipManager
        tooltipManager.bioBrickTooltipPanel = biobrickTooltipPanel;
        tooltipManager.deviceTooltipPanel   = deviceTooltipPanel;
        tooltipManager.uiCamera             = GameObject.Find("Camera").GetComponent <Camera>();

        Logger.get().loggerGUIComponent = loggerGUIComponent;
    }
コード例 #19
0
ファイル: DeviceContainer.cs プロジェクト: CyberCRI/Hero.Coli
 // Use this for initialization
 protected virtual void Start () {
   Logger.Log("DeviceContainer::Start()", Logger.Level.TRACE);
   _displayer = safeGetDisplayer();
 }
コード例 #20
0
 // Use this for initialization
 protected virtual void Start()
 {
     Logger.Log("DeviceContainer::Start()", Logger.Level.TRACE);
     _displayer = safeGetDisplayer();
 }
コード例 #21
0
 void Awake()
 {
     Logger.Log("DevicesDisplayer::Awake", Logger.Level.DEBUG);
     _instance = this;
 }