예제 #1
0
    //bool bPut = false;
    public override bool OnCheckPutDown()
    {
        //OnItemOpGUIHide();
#if fasle
        HB_Entity entity = GetComponent <HB_Entity>();
        if (entity != null)
        {
            if (ColonyManager.Instance == null)
            {
                return(false);
            }
            EntityMgrInst entityMgr = ColonyManager.Instance.GetEntityMgrSinglePlayer();
            BuildingState r         = entityMgr.CanRegister(entity);
            if (r == BuildingState.Succeed)
            {
                entity.Register(entityMgr);
            }
            // Show message box
            else if (r == BuildingState.NoAssembly)
            {
                MessageBox_N.ShowOkBox(
                    "You need to build an Assembly building with its static field before you can place down other buildings as per colony safety regulations!");
                return(false);
            }
            else if (r == BuildingState.OutOfMaxCount)
            {
                MessageBox_N.ShowOkBox(
                    "The number of buildings of this type allowed by safety regulations in the current static field has been reached!");
                return(false);
            }
            else if (r == BuildingState.OutOfAssemblyRange)
            {
                MessageBox_N.ShowMsgBox(MsgBoxType.Msg_OK, MsgInfoType.Null,
                                        "The building cannot be placed outside the static field in compliance with Colony Regulations Article 3 Section 2.");
                return(false);
            }
        }
#endif

        // Put off Colonies

        if (!m_NotInWaterOrCave)
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(82209011));
            return(false);
        }

        if (m_CEO != null)
        {
            if (bLimited)
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(3002311));
                return(false);
            }

            CSCreator creator = CSMain.GetCreator(CSConst.ciDefMgCamp);
            int       result  = creator.CanCreate((int)m_CEO.m_Type, transform.position);

            if (result == CSConst.rrtHasAssembly)
            {
                MessageBox_N.ShowOkBox(
                    PELocalization.GetString(8000087));
                return(false);
            }
            else if (result == CSConst.rrtNoAssembly)
            {
                MessageBox_N.ShowOkBox(
                    PELocalization.GetString(8000088));
                return(false);
            }
            else if (result == CSConst.rrtOutOfRange)
            {
                MessageBox_N.ShowOkBox(
                    PELocalization.GetString(8000105));
                return(false);
            }
            else if (result == CSConst.rrtOutOfRadius)
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(8000089));
                return(false);
            }
            else if (result == CSConst.rrtTooCloseToNativeCamp)
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(ColonyErrorMsg.TOO_CLOSE_TO_NATIVE_CAMP0));
                return(false);
            }
            else if (result == CSConst.rrtTooCloseToNativeCamp1)
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(ColonyErrorMsg.TOO_CLOSE_TO_NATIVE_CAMP1));
                return(false);
            }
            else if (result == CSConst.rrtTooCloseToNativeCamp2)
            {
                MessageBox_N.ShowOkBox(PELocalization.GetString(ColonyErrorMsg.TOO_CLOSE_TO_NATIVE_CAMP2));
                return(false);
            }
            else if (result == CSConst.rrtAreaUnavailable)
            {
//				MessageBox_N.ShowOkBox(PELocalization.GetString(ColonyErrorMsg.AREA_UNAVAILABLE));
                return(false);
            }

            m_CEO.m_BoundState = 0;
        }

        //bPut = true;

        return(true);
    }