Exemplo n.º 1
0
    bool OnCheckItemGrid(ItemObject item, CSUI_Grid.ECheckItemType check_type)
    {
        if (m_RefNpc == null)
        {
            return(false);
        }

        return(true);
    }
Exemplo n.º 2
0
    // CSUI_Grid
    bool OnGridCheckItem(ItemObject item, CSUI_Grid.ECheckItemType check_type)
    {
        if (item == null)
        {
            return(true);
        }
        if (PlantInfo.GetPlantInfoByItemId(item.protoId) != null)//--to do: judge if a seed;
        {
            return(true);
        }

        CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotPlantSeed.GetString(), item.protoData.GetName()), Color.red);
        return(false);
    }
Exemplo n.º 3
0
    bool OnGridCheckItem_ToolWeed(ItemObject item, CSUI_Grid.ECheckItemType check_type)
    {
        if (item == null)
        {
            return(true);
        }

        if (item.protoId == ProtoTypeId.INSECTICIDE)
        {
            return(true);
        }

        CSUI_MainWndCtrl.ShowStatusBar(UIMsgBoxInfo.mOnlyCanPutInsecticider.GetString(), Color.red);
        return(false);
    }
Exemplo n.º 4
0
    /// <summary>
    /// check if this grid can put item in
    /// </summary>
    /// <param name="item">target_item</param>
    /// <param name="check_type">operation_type</param>
    /// <returns></returns>
    bool OnGridCheckItem(ItemObject item, CSUI_Grid.ECheckItemType check_type)
    {
        if (!CSUI_MainWndCtrl.IsWorking())
        {
            return(false);
        }

        if (!m_Entity.IsRunning)
        {
            CSCommon com = m_Entity as CSCommon;
            if (com == null)
            {
                CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), CSUtils.GetEntityName(m_Type)), Color.red);
            }
            else
            {
                if (com.Assembly == null)
                {
                    CSUI_MainWndCtrl.ShowStatusBar("The machine is invalid.", Color.red);
                }
                else
                {
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantWorkWithoutElectricity.GetString(), CSUtils.GetEntityName(m_Type)), Color.red);
                }
            }

            return(false);
        }

        if (SelectItem_N.Instance.Place == ItemPlaceType.IPT_HotKeyBar)
        {
            return(false);
        }

        if (m_Type == CSConst.etEnhance)
        {
            if ((m_Entity as CSEnhance).IsEnhancing)
            {
                if (m_enhanceItem != null)
                {
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mHasBeenEnhancingTheItem.GetString(), m_enhanceItem.protoData.GetName()), Color.red);
                }
                return(false);
            }

            if (item != null)
            {
                //if ((item.prototypeData.m_OpType & ItemOperationType.EquipmentItem) == 0
                //    && item.prototypeId < CreationData.s_ObjectStartID)
                //{
                //    return false;
                //}

                Strengthen sItem = item.GetCmpt <Strengthen>();
                if (null != sItem)
                {
                    if (sItem.strengthenTime >= 100)
                    {
                        CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(ColonyMessage.CANNOT_ENHANCE_MORE), item.protoData.GetName()), Color.red);
                        return(false);
                    }
                }
                else
                {
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(PELocalization.GetString(ColonyMessage.CANNOT_ENHANCE_ITEM), item.protoData.GetName()), Color.red);
                    return(false);
                }
            }
        }
        else if (m_Type == CSConst.etRepair)
        {
            if ((m_Entity as CSRepair).IsRepairingM)
            {
                if (m_repairItem != null)
                {
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mHasBeenRepairingTheItem.GetString(), m_repairItem.protoData.GetName()), Color.red);
                }
                return(false);
            }

            if (item != null)
            {
                Repair sItem = item.GetCmpt <Repair>();
                if (sItem == null)
                {
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mNotRequireRepair.GetString(), item.protoData.GetName()), Color.red);
                    return(false);
                }
            }
        }
        else if (m_Type == CSConst.etRecyle)
        {
            if ((m_Entity as CSRecycle).IsRecycling)
            {
                if (m_recycleItem != null)
                {
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mHasBeenRecyclingTheItem.GetString(), m_recycleItem.protoData.GetName()), Color.red);
                }
                return(false);
            }

            if (item != null)
            {
                Recycle sItem = item.GetCmpt <Recycle>();
                //if (item.prototypeId > CreationData.s_ObjectStartID)
                //{
                //    //				return true;
                //}
                //else
                //{
                //    Pathea.Replicator.Formula ms = Pathea.Replicator.Formula.Mgr.Instance.FindByProductId(item.prototypeId);
                //    //MergeSkill ms = MergeSkill.s_tblMergeSkills.Find(
                //    //    delegate(MergeSkill hh)
                //    //    {
                //    //        return hh.m_productItemId == item.mItemID;
                //    //    });

                if (sItem == null || sItem.GetRecycleItems() == null)
                {
                    if (sItem != null)
                    {
                        Debug.LogError(item.nameText + " " + item.protoId + " should not have Recycle!");
                    }
                    CSUI_MainWndCtrl.ShowStatusBar(CSUtils.GetNoFormatString(UIMsgBoxInfo.mCantRecycle.GetString(), item.protoData.GetName()), Color.red);
                    return(false);
                }
                //}
            }
        }

        return(true);
    }