Files
cocos4/cocos/ui/deprecated.ts
T
minggo 95a76235b6 Adjust some files (#12910)
`cocos/core` should not depend other modules, so move some files out of `cocos/core`:
- move some files from `cocos/core` to `cocos/game`
  - director.ts
  - splash-screen.ts
  - game.ts
 - move `cocos/core/root.ts` to `cocos/root.ts` as there is not better module to contain `root.ts`.
 - move `cocos/core/platform/view.ts` to `cocos/ui/view.ts` as screen related logic is moved to `cocos/core/platform/screen.ts`
2022-09-28 09:34:35 +08:00

220 lines
6.8 KiB
TypeScript

/*
Copyright (c) 2020 Xiamen Yaji Software Co., Ltd.
https://www.cocos.com/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
import './deprecated-1.2.0';
import { UICoordinateTracker } from './ui-coordinate-tracker';
import { BlockInputEvents } from './block-input-events';
import { Button } from './button';
import { EditBox } from './editbox/edit-box';
import { Layout } from './layout';
import { ProgressBar } from './progress-bar';
import { ScrollView } from './scroll-view';
import { ScrollBar } from './scroll-bar';
import { Slider } from './slider';
import { Toggle } from './toggle';
import { ToggleContainer } from './toggle-container';
import { Widget } from './widget';
import { PageView } from './page-view';
import { PageViewIndicator } from './page-view-indicator';
import { SafeArea } from './safe-area';
import { warnID } from '../core/platform/debug';
import { ccclass } from '../core/data/class-decorator';
import { js } from '../core/utils/js';
import { legacyCC } from '../core/global-exports';
import { View } from './view';
import { removeProperty, markAsWarning } from '../core';
/**
* @deprecated Since v1.2
*/
@ccclass('cc.UIReorderComponent')
export class UIReorderComponent {
constructor () {
warnID(1408, 'UIReorderComponent');
}
}
legacyCC.UIReorderComponent = UIReorderComponent;
/**
* Alias of [[Button]]
* @deprecated Since v1.2
*/
export { Button as ButtonComponent };
legacyCC.ButtonComponent = Button;
js.setClassAlias(Button, 'cc.ButtonComponent');
/**
* Alias of [[EditBox]]
* @deprecated Since v1.2
*/
export { EditBox as EditBoxComponent };
legacyCC.EditBoxComponent = EditBox;
js.setClassAlias(EditBox, 'cc.EditBoxComponent');
/**
* Alias of [[Layout]]
* @deprecated Since v1.2
*/
export { Layout as LayoutComponent };
legacyCC.LayoutComponent = Layout;
js.setClassAlias(Layout, 'cc.LayoutComponent');
/**
* Alias of [[ProgressBar]]
* @deprecated Since v1.2
*/
export { ProgressBar as ProgressBarComponent };
legacyCC.ProgressBarComponent = ProgressBar;
js.setClassAlias(ProgressBar, 'cc.ProgressBarComponent');
/**
* Alias of [[ScrollView]]
* @deprecated Since v1.2
*/
export { ScrollView as ScrollViewComponent };
legacyCC.ScrollViewComponent = ScrollView;
js.setClassAlias(ScrollView, 'cc.ScrollViewComponent');
/**
* Alias of [[ScrollBar]]
* @deprecated Since v1.2
*/
export { ScrollBar as ScrollBarComponent };
legacyCC.ScrollBarComponent = ScrollBar;
js.setClassAlias(ScrollBar, 'cc.ScrollBarComponent');
/**
* Alias of [[Slider]]
* @deprecated Since v1.2
*/
export { Slider as SliderComponent };
legacyCC.SliderComponent = Slider;
js.setClassAlias(Slider, 'cc.SliderComponent');
/**
* Alias of [[Toggle]]
* @deprecated Since v1.2
*/
export { Toggle as ToggleComponent };
legacyCC.ToggleComponent = Toggle;
js.setClassAlias(Toggle, 'cc.ToggleComponent');
/**
* Alias of [[ToggleContainer]]
* @deprecated Since v1.2
*/
export { ToggleContainer as ToggleContainerComponent };
legacyCC.ToggleContainerComponent = ToggleContainer;
js.setClassAlias(ToggleContainer, 'cc.ToggleContainerComponent');
/**
* Alias of [[Widget]]
* @deprecated Since v1.2
*/
export { Widget as WidgetComponent };
legacyCC.WidgetComponent = Widget;
js.setClassAlias(Widget, 'cc.WidgetComponent');
/**
* Alias of [[PageView]]
* @deprecated Since v1.2
*/
export { PageView as PageViewComponent };
legacyCC.PageViewComponent = PageView;
js.setClassAlias(PageView, 'cc.PageViewComponent');
/**
* Alias of [[PageViewIndicator]]
* @deprecated Since v1.2
*/
export { PageViewIndicator as PageViewIndicatorComponent };
legacyCC.PageViewIndicatorComponent = PageViewIndicator;
js.setClassAlias(PageViewIndicator, 'cc.PageViewIndicatorComponent');
/**
* Alias of [[SafeArea]]
* @deprecated Since v1.2
*/
export { SafeArea as SafeAreaComponent };
legacyCC.SafeAreaComponent = SafeArea;
js.setClassAlias(SafeArea, 'cc.SafeAreaComponent');
/**
* Alias of [[UICoordinateTracker]]
* @deprecated Since v1.2
*/
export { UICoordinateTracker as UICoordinateTrackerComponent };
js.setClassAlias(UICoordinateTracker, 'cc.UICoordinateTrackerComponent');
/**
* Alias of [[BlockInputEvents]]
* @deprecated Since v1.2
*/
export { BlockInputEvents as BlockInputEventsComponent };
legacyCC.BlockInputEventsComponent = BlockInputEvents;
js.setClassAlias(BlockInputEvents, 'cc.BlockInputEventsComponent');
// #region deprecation on view
removeProperty(View.prototype, 'View.prototype', [
{
name: 'isAntiAliasEnabled',
suggest: 'The API of Texture2d have been largely modified, no alternative',
},
{
name: 'enableAntiAlias',
suggest: 'The API of Texture2d have been largely modified, no alternative',
},
]);
markAsWarning(View.prototype, 'View.prototype', [
{
name: 'adjustViewportMeta',
},
{
name: 'enableAutoFullScreen',
suggest: 'use screen.requestFullScreen() instead.',
},
{
name: 'isAutoFullScreenEnabled',
},
{
name: 'setCanvasSize',
suggest: 'setting size in CSS pixels is not recommended, please use screen.windowSize instead.',
},
{
name: 'getCanvasSize',
suggest: 'please use screen.windowSize instead.',
},
{
name: 'getFrameSize',
suggest: 'getting size in CSS pixels is not recommended, please use screen.windowSize instead.',
},
{
name: 'setFrameSize',
suggest: 'setting size in CSS pixels is not recommended, please use screen.windowSize instead.',
},
{
name: 'getDevicePixelRatio',
suggest: 'use screen.devicePixelRatio instead.',
},
{
name: 'convertToLocationInView',
},
{
name: 'enableRetina',
},
{
name: 'isRetinaEnabled',
},
{
name: 'setRealPixelResolution',
},
]);